473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting Sort Key / Value of Datagrid

1
Hello All:

I have a datagrid in my C# windows application (2.0). I have a routine that is refreshing the datagrid, which is causing it to lose its preselected sort. When this refresh happens, I need to run a method to pull out the sort value so I can re-apply it after the refresh happens but I cannot find out how to pull the sort value from the datagrid.

Can anyone help me with this?

Thanks
Andy
Feb 18 '08 #1
4 1079
Plater
7,872 Expert 4TB
Is this a DataGrid or a DataGridView? I am going to assume you're using the current DataGridView and not the outdated DataGrid.
Then there should be an event that gets triggered when a sort happens (ColumnHeaderClick maybe?) where you can update some state object to keep track of the sort order?
Feb 18 '08 #2
kolony
2
Is this a DataGrid or a DataGridView? I am going to assume you're using the current DataGridView and not the outdated DataGrid.
Then there should be an event that gets triggered when a sort happens (ColumnHeaderClick maybe?) where you can update some state object to keep track of the sort order?
What if it is a Datagrid and not a DataGridView? I have the same issue but do not have a DataGridView to work with. Thanks.
Feb 20 '08 #3
Plater
7,872 Expert 4TB
What if it is a Datagrid and not a DataGridView? I have the same issue but do not have a DataGridView to work with. Thanks.
Then I'm not sure what to tell you, DataGrid was such an awful pain to get to do anything. Once you hit .NET2.0 and higher you get the DataGridView and life gets much easier.

Did DataGrid even support sorting by clicking columns?
Feb 20 '08 #4
kolony
2
Then I'm not sure what to tell you, DataGrid was such an awful pain to get to do anything. Once you hit .NET2.0 and higher you get the DataGridView and life gets much easier.

Did DataGrid even support sorting by clicking columns?
Unfortunately, it does. Thanks for trying.
Feb 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: | last post by:
Is there an event that is invoked when a user sorts a column in a Windows Forms DataGrid? I have context senstive icons that are enabled\disabled depending upon the selected item in the...
2
by: Red Green | last post by:
I have a form with a datagrid and a dataset bound to it. I want to launch a second form and pass it a value from whichever record the user has selected. I can't find an example anywhere that shows...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
5
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
4
by: Joe | last post by:
Hello, I have a datagrid in an nested html table (one table inside of another table) and have set the allowsSorting property to true. I've created in the code-behind a method (Sub - I'm using...
1
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated...
4
by: G .Net | last post by:
Hi I have a question which I hope you can help with. I am setting the DataSource of a DataGrid to be a DataView. I am sorting the DataView by various fields which include a Date. When I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.