Solved

Gridview templatefield sorting

Posted on 2014-01-28
3
384 Views
Last Modified: 2014-02-04
Hi,

I have templatefield as shown below;

<asp:TemplateField HeaderText="Template Name" >
                            <EditItemTemplate>
                                <asp:TextBox ID="txttempName" runat="server" Text='<%# Bind("TEMPLATE_NAME") %>' CssClass="" MaxLength="30"></asp:TextBox>

                            </EditItemTemplate>

                            <ItemTemplate>
                                <asp:Label ID="LabeltempName" runat="server" Text='<%# Bind("TEMPLATE_NAME") %>'></asp:Label>
                                                            </ItemTemplate>
                        </asp:TemplateField>

Now please could help me out as how to implement sorting on this without use of linkbutton or hyperlink.


Thanks in advance...
0
Comment
Question by:mannevenu26
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 39816982
Set the sortexpression to PROPERTY field. Please note that it should not a simple variabale.

Example.
<asp:TemplateField HeaderText="Category" SortExpression="Category">
   <ItemTemplate>A value</ItemTemplate>
</asp:TemplateField>

......

public class yourclass
{
   //Define Category property here
}

Open in new window

0
 

Author Comment

by:mannevenu26
ID: 39817466
What property should i define in this class? can u please give me one example..
0
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 39817735
What field you bind to the column. Please mention that.

For your reference http://csharpdotnetfreak.blogspot.com/2012/06/sorting-gridview-columns-headers-aspnet.html
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question