Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
How to get internal links to different records in the grid?
posted

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?

Parents
No Data
Reply
  • 5739
    posted

    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>&nbsp;
        <asp:LinkButton ID="B" runat="server">B</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="C" runat="server">C</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="D" runat="server">D</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="E" runat="server">E</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="F" runat="server">F</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="G" runat="server">G</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="H" runat="server">H</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="I" runat="server">I</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="J" runat="server">J</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="K" runat="server">K</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="L" runat="server">L</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="M" runat="server">M</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="N" runat="server">N</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="O" runat="server">O</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="P" runat="server">P</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="Q" runat="server">Q</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="R" runat="server">R</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="S" runat="server">S</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="T" runat="server">T</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="U" runat="server">U</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="V" runat="server">V</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="W" runat="server">W</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="X" runat="server">X</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="Y" runat="server">Y</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="Z" runat="server">Z</asp:LinkButton>&nbsp;
        <asp:LinkButton ID="Num" runat="server">#</asp:LinkButton>&nbsp;


        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

Children
No Data