I am trying to achieve the below HTML in a Gridview but not getting the results i require
<tbody>
<tr>
<th element="row">Name</th>
<td>Data 1 </td>
<td>Data 2 </td>
<td>Data 3</td>
</tr>
<tr></tr>
<tbody>
Im struggling with <th element="row">Name</th>
area. In my OnRowDataBound (removed some code for clarity) I have the below
protected void gv1_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TableCellCollection cell = e.Row.Cells;
cell[0].Attributes.Add("th", "element");
}
}
but this produces the below HTML
<td th="element">
Other rows seem to be ok.
My inline code is
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
....
How could i achieve the required HTML?