css friendly writes wrong location for <thead> in Webkit html

Jun 1, 2010 at 9:28 PM

Using VisualStudio 2010 and .NET 3.5

I have a GridView created programatically. CSS Friendly & VB render the HTML correctly in Firefox, IE & Opera. In Webkit browsers, however, the <thead> tag is written at the end of the table code and <th> columns are written at the begining of <tbody>. Needless to say, this causes jQuery Datatable to malfunction.

Any ideas for a fix or workaround? Many thanks!

HTML Generated in Webkit only:

<table id="itemsGrid" >
	<tbody>
		<tr>
			<th scope="col">Image</th>
			<th scope="col">Number</th>
			<th scope="col">Description</th>
			<th scope="col">Price</th>
			<th scope="col">Unit</th>
			<th scope="col">Select</th>
			<th scope="col">Details</th>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
	</tbody>
	<thead></thead>
</table>

Code-Behind
Dim dataV As DataView = IM_Common.GetItemList(sSearch)

Dim itemsGrid As New GridView()

itemsGrid.ID = "itemsGrid"
itemsGrid.AutoGenerateColumns = False
itemsGrid.AllowPaging = False
itemsGrid.DataSource = dataV

Dim Field1 As New ImageField
Field1.DataImageUrlField = "ImagePath"
Field1.HeaderText = "Image"
Field1.DataImageUrlFormatString = filePath
Field1.NullDisplayText = "No Image"
Dim Col1 As DataControlField = Field1
itemsGrid.Columns.Add(Col1)

Dim Field2 As New BoundField
Field2.DataField = "ItemID"
Field2.HeaderText = "Number"
Dim Col2 As DataControlField = Field2
itemsGrid.Columns.Add(Col2)

Dim Field3 As New BoundField
Field3.DataField = "ShortDesc"
Field3.HeaderText = "Description"
Dim Col3 As DataControlField = Field3
itemsGrid.Columns.Add(Col3)

Dim Field4 As New BoundField
Field4.DataField = "CustPrice"
Field4.HeaderText = "Price"
Dim Col4 As DataControlField = Field4
itemsGrid.Columns.Add(Col4)

Dim Field5 As New BoundField
Field5.DataField = "UserFld1"
Field5.HeaderText = "Unit"
Dim Col5 As DataControlField = Field5
itemsGrid.Columns.Add(Col5)

Dim field6 As New TemplateField()
field6.ItemTemplate = New CheckBoxTemplate("Add")
field6.HeaderText = "Select"
Dim Col6 As DataControlField = field6
itemsGrid.Columns.Add(Col6)

Dim Field0 As New HyperLinkField
Dim navFields(0) As String = "ItemID"
Field0.Text = "More Info"
Field0.HeaderText = "Details"
Field0.DataNavigateUrlFields = navFields
Field0.DataNavigateUrlFormatString = "itemDetail.aspx?iID={0}"
Dim Col0 As DataControlField = Field0
itemsGrid.Columns.Add(Col0)

AddHandler itemsGrid.RowDataBound, AddressOf itemsGridRowBound
itemsGrid.DataBind()
itemsHolder.Controls.Add(itemsGrid)