|
-
August 18th, 2009, 11:45 AM
#1
Sorting Template Columns in a Datagrid
My data grid is set to allow sorting..
I have looked up a few ways to do this and am Still a bit unclear.
What steps need to be taken from here to make the column header a link to make the dataset coming in 'Asc' , 'Desc' Sortable..
I am using C# in the back
Code:
<asp:TemplateColumn SortExpression="Email_Add" HeaderText="Email Address">
<HeaderTemplate>Email Address</HeaderTemplate>
<ItemTemplate>
<asp:Label id=lblEmail_Provided Font-Bold="true" Runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Email_Add") %>'
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
-
August 27th, 2009, 08:47 AM
#2
Re: Sorting Template Columns in a Datagrid
To make a link appeared at the column header that allows sorting on the result,
you have to put SortExpression in your TemplateColumn, like your provided code
<asp:TemplateColumn SortExpression="Email_Add" HeaderText="Email Address">
Definite AllowSorting is a must to enabled.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|