developer155
Programmer
Hi,
I have a gridview that shows data. I need to use HTML to display gridview headers. The reason I am using htm is because one of the headers shoudl call JS function when clicked. The problem is that the html header does nto lign up with gridview. How can I align them and also remove the placeholders for headings in gridview. Here is my code:
<table cellpadding="0" cellspacing="0" border="0" class="lists">
<tr class="header">
<th class="id">ID</th>
<th class="name">list name</th>
<th class="dbTable">table name</th>
<th class="edit"><img src="media/i_add.gif" alt="add" onclick="rowAdd()" /></th>
<th class="delete"> </th>
</tr>
<tr>
<td>
<asp:gridview id="CustomLists"
autogeneratecolumns="false"
allowpaging="true"
runat="server"
OnRowDataBound="CustomLists_RowDataBound">
<Columns>
<asp:BoundField ReadOnly="True" DataField="customListID" SortExpression="customListID" ItemStyle-CssClass="id"></asp:BoundField>
<asp:BoundField ReadOnly="True" DataField="name" SortExpression="name" ItemStyle-CssClass="name"></asp:BoundField>
<asp:BoundField ReadOnly="True" DataField="source" SortExpression="source" ItemStyle-CssClass="dbTable"></asp:BoundField>
<asp:TemplateField ItemStyle-CssClass="edit">
<ItemTemplate>
<img alt="Edit" runat="server" id ="Edit" src="media/i_edit.gif" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ItemStyle-CssClass="delete">
<ItemTemplate>
<img alt="Edit" runat="server" id ="Delete" src="media/i_delete_disabled.gif" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
</table>
I have a gridview that shows data. I need to use HTML to display gridview headers. The reason I am using htm is because one of the headers shoudl call JS function when clicked. The problem is that the html header does nto lign up with gridview. How can I align them and also remove the placeholders for headings in gridview. Here is my code:
<table cellpadding="0" cellspacing="0" border="0" class="lists">
<tr class="header">
<th class="id">ID</th>
<th class="name">list name</th>
<th class="dbTable">table name</th>
<th class="edit"><img src="media/i_add.gif" alt="add" onclick="rowAdd()" /></th>
<th class="delete"> </th>
</tr>
<tr>
<td>
<asp:gridview id="CustomLists"
autogeneratecolumns="false"
allowpaging="true"
runat="server"
OnRowDataBound="CustomLists_RowDataBound">
<Columns>
<asp:BoundField ReadOnly="True" DataField="customListID" SortExpression="customListID" ItemStyle-CssClass="id"></asp:BoundField>
<asp:BoundField ReadOnly="True" DataField="name" SortExpression="name" ItemStyle-CssClass="name"></asp:BoundField>
<asp:BoundField ReadOnly="True" DataField="source" SortExpression="source" ItemStyle-CssClass="dbTable"></asp:BoundField>
<asp:TemplateField ItemStyle-CssClass="edit">
<ItemTemplate>
<img alt="Edit" runat="server" id ="Edit" src="media/i_edit.gif" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ItemStyle-CssClass="delete">
<ItemTemplate>
<img alt="Edit" runat="server" id ="Delete" src="media/i_delete_disabled.gif" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
</table>