Ok, Here is the DataGrid's HTML code first:
<asp:datagrid id="dgAgwayCust" style="Z-INDEX: 108; LEFT: 8px; POSITION: absolute; TOP: 48px"
runat="server" Height="286px" OnItemCommand="dgAgwayCustButton_Click" PageSize="6" DataKeyField="SeqNo" BackColor="White" BorderStyle="None" BorderWidth="1px" BorderColor="#999999"
OnSelectedIndexChanged="dgAgwayCust_Select" AutoGenerateColumns="False" CellPadding="3" PagerStyle-Mode="NextPrev" AllowPaging="True" OnPageIndexChanged="dgAgwayCust_Page" GridLines="Vertical"
Font-Names="Verdana" Font-Size="8pt" AllowSorting="True" OnSortCommand="dgAgwayCust_SortEventHandler">
<SelectedItemStyle Font-Size="8pt" Font-Names="Verdana" Font-Bold="True" Wrap="False" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<EditItemStyle Font-Size="8pt" Font-Names="Verdana" Wrap="False"></EditItemStyle>
<AlternatingItemStyle Font-Size="8pt" Font-Names="Verdana,Arial,Helvetica,sans-serif" Wrap="False" BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle Font-Size="8pt" Font-Names="Verdana,Arial,Helvetica,sans-serif" Wrap="False" ForeColor="Black"
BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Size="8pt" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Bold="True"
Wrap="False" HorizontalAlign="Center" ForeColor="White" BackColor="#000084"></HeaderStyle>
<FooterStyle Font-Size="8pt" Font-Names="Verdana,Arial,Helvetica,sans-serif" HorizontalAlign="Center"
ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:ButtonColumn Text="Edit" CommandName="Edit">
<ItemStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True"></ItemStyle>
</asp:ButtonColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete">
<ItemStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True"></ItemStyle>
</asp:ButtonColumn>
<asp:ButtonColumn Text="Show details" CommandName="Select">
<ItemStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="SeqNo">
<ItemStyle Font-Size="8pt" Font-Names="Verdana"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustNo" SortExpression="CustNo" ReadOnly="True" HeaderText="Customer Nbr">
<HeaderStyle Width="80px"></HeaderStyle>
<ItemStyle Font-Size="8pt" Font-Names="Verdana"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustName1" SortExpression="CustName1" ReadOnly="True" HeaderText="Customer Name">
<HeaderStyle Width="250px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustAddr1" SortExpression="CustAddr1" ReadOnly="True" HeaderText="Address">
<HeaderStyle Width="250px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustCity" SortExpression="CustCity" ReadOnly="True" HeaderText="City">
<HeaderStyle Width="130px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustST" SortExpression="CustST" ReadOnly="True" HeaderText="ST">
<HeaderStyle Width="30px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustZip" SortExpression="CustZip" ReadOnly="True" HeaderText="Zip">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustPhone" SortExpression="CustPhone" ReadOnly="True" HeaderText="Phone">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CustFax" SortExpression="CustFax" ReadOnly="True" HeaderText="Fax">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="SalesNumber" SortExpression="SalesNumber" ReadOnly="True" HeaderText="Sls">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="SeqNo" ReadOnly="True" HeaderText="SeqNo"></asp:BoundColumn>
</Columns>
<PagerStyle Font-Size="8pt" Font-Names="Verdana,Arial,Helvetica,sans-serif" HorizontalAlign="Center"
ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
Now here are some functions:
Sub dgAgwayCust_Page(ByVal Sender As Object, ByVal E As DataGridPageChangedEventArgs)
' display a new page of data
dgAgwayCust.EditItemIndex = -1
dgAgwayCust.CurrentPageIndex = E.NewPageIndex
BindCustGrid(strCustGridSort)
BindCallGrid()
End Sub
Sub dgAgwayCust_SortEventHandler(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
strCustGridSort = e.SortExpression & " ASC"
BindCustGrid(strCustGridSort)
'Dim dgHeader As DataGridItem
'dgHeader = e.CommandSource
'TextBox1.Text = dgAgwayCust.Columns(dgAgwayCust.SelectedIndex).HeaderText
'TextBox1.Text = dgAgwayCust.SelectedItemStyle.BackColor.ToString
'dgAgwayCust.SelectedItemStyle.
End Sub
Disregard the remarks. I was trying to find the header.