Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Gridview templatefield sorting

Posted on 2014-01-28
3
Medium Priority
?
387 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 1500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 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