Solved

Datagridview reordering

Posted on 2014-01-13
2
391 Views
Last Modified: 2014-01-14
hi - I'm working with a datagridview control. I would like to disable the feature that allows the user to click on the header bar and the respective column is reordered (one click orders ascending, the next click orders descending.) at best this is confusing in the context of the application, and it might be reordering values as they are read back in to my permanent storage, since it only reorders a single column, not the entire row.
thanks,
0
Comment
Question by:jdcoburn
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39778275
Set the SortMode property of the columns to NotSortable instead of the default Automatic value.
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 39778578
Hi,

if you want to disable sorting for a specific column then you can use SortExpression="" like following:

<asp:BoundField HeaderText="Header Name" DataField="FieldName" SortExpression="" />


and for complete grid you can use allowsorting="false"  as following:

<asp:gridview id="gv"
        allowsorting="false"
        runat="server">

Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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