Does There Exist An Alphabetical Hyperlink Web Control

Posted on 2006-05-30
Last Modified: 2008-01-09
that will link each letter of the alphabet to the place in the GridView (or other control) where that letter begins in the list?

Also, if I want to display only those records that begin with the corresponding letter selected from the Hyperlink Link what would be the recommended approach?  

Question by:FoxProMari
    LVL 19

    Expert Comment

    I don't think there's any such built in Control
    You need to Filter the Records in Grid manually basde on Alphabet

    Author Comment

    Okay, I can do that.  Can you tell me if and how I can use a wildcard with the filtering expression such as
                     Session["Letter"] = "A%"

    to do the filtering so that I pick up any value in the FName field that begins with A?  I know how to do it in SQL but not in

    Thanks for your help.
    LVL 19

    Expert Comment

    I hope what you are asking is you want to match if the string value stored in Session["Letter"] starts with "A"
    If you need a complex matching you need to use RegEx though in this case the following would do

    Dim Letter As String = Session["Letter"]
    if Letter.StartsWith("A") then
    End if

    Author Comment

    I'm sorry, I forgot to mention I'm writing in C#.

    I have a SQLDataSource which populates a GridView.  I have the the mode set to dataset and caching is enabled.  What I'm trying to do is click on a hyperlink where code executes which sets the Session value of the variable Letter to the corresponding letter which was clicked.  How do I then set the FilteringExpression of the SqlDataSource to compare the value of FName (field value returned by the SQLDataSource and displayed in the GridView) to use the Session value of the variable Letter.  I understand that I should compare FName.StartsWith(Letter) however I don't know how to properly access this value nor where to put this in the code-behind.

    Or is it even possible to do it this way?  Should I just go ahead and use a data adapter, tables, rows & dataview?

    Thanks for your help.  If you need me to increase the points, please just let me know.  Thanks.
    LVL 19

    Accepted Solution

    Hi FoxProMari
    looks like you are using VS 2005, Sorry but I have no idea of 2005 as of yet.
    In the older version all you needed to do was set the RowFilter property of the DataGrid's Tabel's DefaultView to the Where clause for selecting Names starting with "A"
    string Letter =  Session["Letter"];
    MyDataTable.DefaultView.RowFilter="FName like '" + Letter + "%'"
    then bind the Datagrid to the DataTable

    I just tried the Net for 2005, it seems we need to user parameters for this, now in yor case what you can do is on the Hyperlink click pass a QueryString value as well to the Page and then Filter by QueryString look at this page

    and for the specific Filter by QueryString

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now