Home > Not Working > Asp.net Gridview Sorting Not Working

Asp.net Gridview Sorting Not Working

Contents

Do you need your password? It's got ~20 internal users and 100 records. I have added ScriptManager in MasterPage HTML: <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> have a peek at this web-site

We have a more flexible stringbuilder based admin panel that's more appropriate for specs of this particular application. For your task, I recommend you useanapproach from theHow to bind ASPxGridView with autogenerated columns to different data sources at runtime. I will not demonstrate any database connectivity code. To determine the current sort direction, use the SortDirection property.The GridView control provides several events that you can use to perform a custom action when sorting occurs.

Gridview Allowsorting

The content posted here is free for public and is the content of its poster. int sortColumnIndex = GetSortColumnIndex(); if (sortColumnIndex != -1) { // Call the AddSortImage helper method to add // a sort direction image to the appropriate // column header. The time now is 05:56 PM. The site does not provide any warranties for the posted content.

chieftain 2010-12-10 20:40:01 UTC #4 Great Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Podcast Articles Premium 12,584,807 members (71,533 online) Sign in Why is looping over find's output bad practice? You can determine the sort expression that the GridView control is applying by using the SortExpression property. Pro How 5 Companies Maintain Optimal .NET Performance Pro Top 5 .NET Metrics, Tips & Tricks ASP.NET GridView ASCII and Numeric Sorting SAPrefs - Netscape-like Preferences Dialog ASP.NET GridView Sort Indicator

i forgot to put it inside the if statement –C.O.D.E Feb 11 '13 at 14:46 let me check.... –T-student Feb 11 '13 at 14:56 dose not work Gridview Sortexpression Not Working if (e.Row.RowType == DataControlRowType.Header) { // Call the GetSortColumnIndex helper method to determine // the index of the column being sorted. Build me a brick wall! Homepage share|improve this answer answered Feb 12 '13 at 9:00 T-student 66921544 add a comment| up vote 0 down vote Try this: protected void grdCause_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression =

How can I safely handle a concentrated (fuming) nitric acid spill? Please review the code and correct me where I ve missed. Done. ASP.Net Website Developer.

Gridview Sortexpression Not Working

Understand that English isn't everyone's first language so be lenient of bad spelling and grammar. navigate here Here is code of aspx page: Check This Out Use an ASP.NET -->

Possible repercussions from assault between coworkers outside the office Animated plot required to leave behind trace Why is the 'You talking to me' speech from the movie 'Taxi Driver' so famous? This event is often used to cancel the sorting operation or to perform a custom sorting routine. About Us Connect with DevExpress BlogsUpcomingEventsTrainingWebinars Learn More about DevExpress About Us News User Comments Case Studies Our Awards Reviews & Publications MVP Program Contact Us Support Center FAQ Training Events http://sohohosting.net/not-working/aspx-gridview-sorting-not-working.html All rights reserved.

Your Email Password Forgot your password? My Account ManageYour Profile Change your addressemail and password Assign Licenses Manage licensesfor your dev team Renew anExisting SubscriptionPurchaseHistory New order statusand previous purchases DownloadYour Products Need help or require more Table name: Students Table columns: Students Name Students Div Student Roll number Student Class Let assign the Data Table to Gridview.

Email us at [email protected] or call +1 (818) 844-3383 between 7:30AM and 4:30PM Pacific Time.

When sorting is enabled, the heading text for each column field with its SortExpression property set is displayed as a link button.Note The SortExpression property for an automatically generated columns field To determine the requirements, see the documentation for the specific data source.To enable sorting, set the AllowSorting property to true. Google Developer Network Developer Network Developer Sign in MSDN subscriptions Get tools Downloads Visual Studio MSDN subscription access SDKs Trial software Free downloads Office resources SharePoint Server 2013 resources SQL Server Drag and drop gridview on your page. Set AllowSorting property to true, add OnSorting event to the gridview. Create data table that

Image sortImage = new Image(); if (CustomersGridView.SortDirection == SortDirection.Ascending) { sortImage.ImageUrl = "~/Images/Ascending.jpg"; sortImage.AlternateText = "Ascending Order"; } else { sortImage.ImageUrl = "~/Images/Descending.jpg"; sortImage.AlternateText = "Descending Order"; } // Add the Typically, the sort expression is simply the name of the field displayed in the column, which causes the GridView control to sort with respect to that column. ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(this.GridView1); Try it. have a peek here C#VB Copy <%@ Page language="C#" %> GridView AllowSorting Example

GridView AllowSorting Example

Sign in using Search within: Articles Quick Answers Messages Use my saved content filters home articles Chapters and Sections> Search Latest Articles Latest Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update c# asp.net sorting gridview gridview-sorting share edited Mar 22 '11 at 13:51 Jordan Arron 26.2k106392 asked Mar 21 '11 at 12:49 asma 1,490114277 merged by Will Mar 22 '11 at 17:12 Linux questions C# questions ASP.NET questions fabric questions SQL questions discussionsforums All Message Boards... Powered by Excelasoft Solutions.

Support Support Center Search the KB My Questions Code Examples Resources Getting Started Documentation Demos Training Webinars Contact our Developer Advocates anytime. I removed the allowsorting attribute rebuilt the app, then added it back and rebuilt again. Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies We appreciate your feedback.

Chroniclemaster1 2010-12-10 19:47:11 UTC #3 Thanks, I've never had to use that before, but it worked great.