Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
passing soret expression and direction in pagination method
Posted
Comments
Tejas Vaishnav 17-Oct-11 4:50am    
Provide more detail, what you need..
[no name] 6-Dec-11 23:36pm    
Are you asking or just saying?

1 solution

In Markup set GridView attributes as given bellow
XML
AllowSorting="True" 
OnSorting="gridView_Sorting"

For each column Header Template do the following
XML
<asp:TemplateField SortExpression="YourFieldName">
     <HeaderTemplate>
<asp:LinkButton ID="linkbutton" runat="server" Width="100%"                                        CommandName="Sort" CommandArgument=" YourFieldName" />
     </HeaderTemplate>
     <ItemTemplate></ItemTemplate?                 
</asp:TemplateField>

And

In code behind gridview_Sorting event handler
Use e.SortExpression and e.SortDirection to further implement the logic.

HTH
 
Share this answer
 
v3
Comments
[no name] 6-Dec-11 23:38pm    
Just a suggestion, always wrap your code with "pre" tags.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900