Results 1 to 2 of 2

Thread: Gridview Sorting Trouble

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2012
    Posts
    34

    Gridview Sorting Trouble

    I have a gridview and a few datasources on my web page. In the code behind, I set the gidview's SqlDataSourceId based on which checkbox is checked.
    I allowed sorting for the gridview. For some reason, some of the columns get sorted when I click on it, and some don't sort at all. Do you know what may be causing this?
    Thank you.

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Gridview Sorting Trouble

    I assume this is asp.net right?

    Have you applied sorting expression for each bound columns
    similar to the code below?

    Code:
    <asp:BoundField HeaderText="Customer Code" 
                      DataField="CustomerID" SortExpression="CustomerID">
                    </asp:BoundField>
    Cheers!
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width