I have a grid that displays and employee directory. There are hundreds of employees. I want to be able to specify internal links for each letter of the alphabet so that if they click on the "F' at the top of the page, they will be jumped to the F section of the directory.
How should I go about doing this?
Hi,
This isn't exactly what you're asking, but it might give you a great workaround. I have a bunch of link buttons and rebind the datasource according to the letter picked. It's so much easier for the user. It's all in an updatepanel so it happens fast.
<asp:LinkButton ID="A" runat="server">A</asp:LinkButton> <asp:LinkButton ID="B" runat="server">B</asp:LinkButton> <asp:LinkButton ID="C" runat="server">C</asp:LinkButton> <asp:LinkButton ID="D" runat="server">D</asp:LinkButton> <asp:LinkButton ID="E" runat="server">E</asp:LinkButton> <asp:LinkButton ID="F" runat="server">F</asp:LinkButton> <asp:LinkButton ID="G" runat="server">G</asp:LinkButton> <asp:LinkButton ID="H" runat="server">H</asp:LinkButton> <asp:LinkButton ID="I" runat="server">I</asp:LinkButton> <asp:LinkButton ID="J" runat="server">J</asp:LinkButton> <asp:LinkButton ID="K" runat="server">K</asp:LinkButton> <asp:LinkButton ID="L" runat="server">L</asp:LinkButton> <asp:LinkButton ID="M" runat="server">M</asp:LinkButton> <asp:LinkButton ID="N" runat="server">N</asp:LinkButton> <asp:LinkButton ID="O" runat="server">O</asp:LinkButton> <asp:LinkButton ID="P" runat="server">P</asp:LinkButton> <asp:LinkButton ID="Q" runat="server">Q</asp:LinkButton> <asp:LinkButton ID="R" runat="server">R</asp:LinkButton> <asp:LinkButton ID="S" runat="server">S</asp:LinkButton> <asp:LinkButton ID="T" runat="server">T</asp:LinkButton> <asp:LinkButton ID="U" runat="server">U</asp:LinkButton> <asp:LinkButton ID="V" runat="server">V</asp:LinkButton> <asp:LinkButton ID="W" runat="server">W</asp:LinkButton> <asp:LinkButton ID="X" runat="server">X</asp:LinkButton> <asp:LinkButton ID="Y" runat="server">Y</asp:LinkButton> <asp:LinkButton ID="Z" runat="server">Z</asp:LinkButton> <asp:LinkButton ID="Num" runat="server">#</asp:LinkButton>
Protected Sub A_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles A.Click, B.Click, C.Click, D.Click, E.Click, F.Click, G.Click, H.Click, I.Click, J.Click, K.Click, L.Click, M.Click, N.Click, O.Click, P.Click, Q.Click, R.Click, S.Click, T.Click, U.Click, V.Click, W.Click, X.Click, Y.Click, Z.Click, Num.Click If DirectCast(sender, LinkButton).ID = "Num" Then Session("SQLCommand") = "SELECT [CustomerID], [Customer], [AddressLine1], [City], [State], [Zip], [SalesPerson], [CSR] FROM [Customer] WHERE [CustomerID] Like '1%' OR [CustomerID] Like '2%' OR [CustomerID] Like '3%' OR [CustomerID] Like '4%' OR [CustomerID] Like '5%' OR [CustomerID] Like '6%' OR [CustomerID] Like '7%' OR [CustomerID] Like '8%' OR [CustomerID] Like '9%' OR [CustomerID] Like '0%'" SqlDataSource1.SelectCommand = Session("SQLCommand") Else Session("SQLCommand") = "SELECT [CustomerID], [Customer], [AddressLine1], [City], [State], [Zip], [SalesPerson], [CSR] FROM [Customer] WHERE [CustomerID] Like '" & DirectCast(sender, LinkButton).ID & "%'" SqlDataSource1.SelectCommand = Session("SQLCommand")
End If WebDataGrid1.Rows.Clear() WebDataGrid1.DataBind() End Sub
Ed