Datagrid with fixed width columns

I created a dynamic calendar using a datagrid with a width of 700px with each of the seven days set to 100px. I thought this would keep days in a fixed width column, but that was not the case.

I had to add the following to my code and then the columns stayed fixed:


dgrCalendar.Style.Add("table-layout", "fixed")

Dynamically set datagrid HeaderText

I am creating a ASP .Net page to maintain all of my lookup tables, rather than creating a separate page for every 2-4 field table.

Initially I thought I would change the headertext property during the datagrids OnItemDataBound event, checking for ListItemType.Header, etc. This proved a bit convoluted with the resolution being much simpler:

dgrLookupTable.Columns(1).HeaderText = "Source"

The ASP code looks like this:

  1. <asp:TemplateColumn SortExpression="1" HeaderText="">
  2. <HeaderStyle Width="150px"></HeaderStyle>
  3. <ItemStyle Wrap="False"></ItemStyle>
  4. <ItemTemplate>
  5. <span class="dgrOverflow">
  6. <%#Container.DataItem("1")%>
  7. </span>
  8. </ItemTemplate>
  9. <EditItemTemplate>
  10. <ASP:TextBox Size="40" id="txt1" Text='<%# Container.DataItem("1")%>' runat="server" />
  11. </EditItemTemplate>
  12. </asp:TemplateColumn>

Nietzche

Men believe in the truth of all that is seen to be strongly believed in.

Slaughterhouse – The Handbook of the Eastern Front

Extraordinary detail on both German and Russian units. First part of book provides brief descriptions of the major players in the conflict. Maps and illustrated unit organization diagrams. More of a reference manual.

Slaughterhouse: The Handbook of the Eastern Front

Sledgehammers

Very detailed discussion on the many engineering flaws that handicapped the Tiger’s performance. Great first person accounts at the end of the book from Allied soldiers who faced and destroyed Tigers. Many maps and detailed statistics of Tiger combat losses. One interesting point was that the Germans never developed a mine sweeping vehicle like the British flail. Instead, they would use the Tigers to explode the mines.

Sledgehammers: Strengths and Flaws of Tiger Tank Battalions in World War II

1.1. datagrid in 2.0 .Net environment

My ISP recently migrated all 1.1 accounts to 2.0. All the 1.1 code seems to work fine. One bizarre thing was that the gridlines in all of my datagrids turned to white, which makes them invisible against a white background.

I found a couple posts that said if you made bgcolor=white, you would then be able to see the gridlines. I tried that and it did work, but obviously not a viable solution.

Turns out to be very simple. You need to set the bordercolor attribute of the datagrid in code:

dgrCalendar.Attributes.Add("bordercolor", "Black")

Initial thread

Darkness and Light

A good read. Harvey has a way of binding you to the story. Always a good sign when you look forward to picking up the book the next day. Also has the ability to let you skim sub-plots that you are not interested in. For instance, Elder, the main character, has a strained relationship with his daughter, Katherine. This does provide insight into the characters, but it really doesn’t interest me.

Darkness & Light: A Frank Elder Mystery (Frank Elder Mysteries)

Extracting ViewState and other ASP .Net params

This is a very simple function for extracting any ASP .Net page state value such as __VIEWSTATE or __EVENTVALIDATION. These values are necessary when scraping some websites.

  1. Public Shared Function ExtractDotNetData(ByVal strData As String, ByVal strStateName As String, ByVal strDelimiter As String) As String
  2.  
  3. Dim iStateNamePosition As Integer = strData.IndexOf(strStateName)
  4. If iStateNamePosition < 0 Then Return ""
  5.  
  6. Dim iStateValuePosition As Integer = strData.IndexOf(strDelimiter, iStateNamePosition)
  7. If iStateValuePosition < 0 Then Return ""
  8.  
  9. Dim iStateStartPosition As Integer = iStateValuePosition + strDelimiter.Length
  10. Dim iStateEndPosition As Integer = strData.IndexOf("""", iStateStartPosition)
  11.  
  12. Return HttpUtility.UrlEncodeUnicode(strData.Substring(iStateStartPosition, iStateEndPosition - iStateStartPosition))
  13. End Function
  14.  
  15. strViewState = ExtractDotNetData(strResponseData, "__VIEWSTATE", "value=""")
  16. strEventValidation = ExtractDotNetData(strResponseData, "__EVENTVALIDATION", "value=""")

Ash & Bone

This was the first John Harvey book that I read. Since I pulled it off the shelf at random, I noticed it had a positive blurb from Elmore Leonard. I have had problems connecting with other British writers, so I was a bit leery. Overall, I liked his writing style, though some of the back story seemed a bit too in depth. Looking forward to reading more by this author.

Ash & Bone (Frank Elder Mysteries)

Death Bed

Not bad. I found the ending to be a bit weak, but that is often times the case in the detective genre.

Death bed: A detective story

Tigers in Combat, Vol. 1

Meticulous detail of tank numbering and unit histories. The photographs are what make this book unique. The title is a bit misleading as the vast majority of the photos are not combat related. However, this is nitpicking. Maintenance and recovery photos seem to be from personal collections rather than stock photos.

Tigers in Combat, Vol. 1

The Bielski Brothers

Pretty amazing book about survival of Jewish refugees and partisans in the swamps and forests in Belarus during WWII. Details conflicts and suspicions that arose between the different partisan groups, all of whom were under the suspicion of the Soviet Union.

The Bielski Brothers : The True Story of Three Men Who Defied the Nazis, Built a Village in the Forest, and Saved 1,200 Jews

A sad end for one of the Bielski brothers:

Holocaust hero accused of swindling

File permission error in .Net 2.0

If you are moving a .Net 1.1 app to a server with 2.0, you may need to add the param

<trust level="Full" originUrl="" />

to your web.config if you are doing any sort of file upload.

There may be a more elegant way, but this was the quickest resolution I could find.

« Previous Page