Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview sorting

Gridview sorting

Scheduled Pinned Locked Moved ASP.NET
javascriptcssalgorithmstutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sunil Wise
    wrote on last edited by
    #1

    i am using grid view control in my project i have set autogeneratecolumns false and added columns like this <Columns> <asp:TemplateField HeaderText="User Name" SortExpression="UserName"> <ItemTemplate> <%#Eval("UserName")%> </ItemTemplate> <ItemStyle HorizontalAlign = "Left" /> </asp:TemplateField> <asp:TemplateField HeaderText="Voice Id"> <ItemTemplate> <a href="javascript:DispalyError('<%#Eval("vid")%>','<%#Eval("UserType") %>')" title="<%#Eval("VoiceId")%>"> <%# Eval("VoiceId") %> </a> </ItemTemplate> <ItemStyle HorizontalAlign="Left" /> </asp:TemplateField> (more columns) now i want to have sorting property for all columns in the grid can any body please tell me how to do this regards sunilwise

    C S 2 Replies Last reply
    0
    • S Sunil Wise

      i am using grid view control in my project i have set autogeneratecolumns false and added columns like this <Columns> <asp:TemplateField HeaderText="User Name" SortExpression="UserName"> <ItemTemplate> <%#Eval("UserName")%> </ItemTemplate> <ItemStyle HorizontalAlign = "Left" /> </asp:TemplateField> <asp:TemplateField HeaderText="Voice Id"> <ItemTemplate> <a href="javascript:DispalyError('<%#Eval("vid")%>','<%#Eval("UserType") %>')" title="<%#Eval("VoiceId")%>"> <%# Eval("VoiceId") %> </a> </ItemTemplate> <ItemStyle HorizontalAlign="Left" /> </asp:TemplateField> (more columns) now i want to have sorting property for all columns in the grid can any body please tell me how to do this regards sunilwise

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you turn on the sorting functionality of the grid view, it will render the headers as links, but you will still need to handle the event that is fired, and write the code to sort your data.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • S Sunil Wise

        i am using grid view control in my project i have set autogeneratecolumns false and added columns like this <Columns> <asp:TemplateField HeaderText="User Name" SortExpression="UserName"> <ItemTemplate> <%#Eval("UserName")%> </ItemTemplate> <ItemStyle HorizontalAlign = "Left" /> </asp:TemplateField> <asp:TemplateField HeaderText="Voice Id"> <ItemTemplate> <a href="javascript:DispalyError('<%#Eval("vid")%>','<%#Eval("UserType") %>')" title="<%#Eval("VoiceId")%>"> <%# Eval("VoiceId") %> </a> </ItemTemplate> <ItemStyle HorizontalAlign="Left" /> </asp:TemplateField> (more columns) now i want to have sorting property for all columns in the grid can any body please tell me how to do this regards sunilwise

        S Offline
        S Offline
        Sunil Wise
        wrote on last edited by
        #3

        sir can you please tell me in detail how to handle the event

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups