Supreet
Supreet

Reputation: 2531

Grid view sorting

i am using this code for sorting in grid view but this is not working. please help

 <asp:TemplateField SortExpression="FirstName">
                <HeaderTemplate>
                    Name
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Name")%>
                </ItemTemplate>
            </asp:TemplateField>

Upvotes: 0

Views: 213

Answers (1)

Silagy
Silagy

Reputation: 3083

You mentioned that you don't see link at the table's header.

It might help you,

Make sure that you set the AllowSorting="true" and created a event to handle it OnSorting="gvActivities_Sorting"

 <asp:GridView runat="server" ID="gvActivities" AllowSorting="true" 
 OnSorting="gvActivities_Sorting">

If you did it you should get a link in the header.

If not post the all gridview decleration

Upvotes: 1

Related Questions