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

x
?
Solved

Datagridview reordering

Posted on 2014-01-13
2
Medium Priority
?
413 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
[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 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 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