473,769 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I sort the columns (not rows) in a DataGrid?

I have a Windows Forms app in which I have a DataGrid control. I have a
custom class that has several properties exposed, and I have made this
class, or a collection thereof, the DataSource of the DataGrid. This neat
feature of the DataGrid allows the properties to be displayed in a
Collection of this class.

Now, how do I order the columns (not to be confused with the rows, which is
managed by the collection)? Is there a simple process to do this, while
still using my simple class and not resorting to ADO.NET or XML? I would
prefer not to move to ADO.NET or XML, but if it's my only option I'd like to
know.

Jon
Nov 15 '05
11 1354
Found the answer here:

http://support.microsoft.com/default...b;EN-US;317550

Jon

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I have a Windows Forms app in which I have a DataGrid control. I have a
custom class that has several properties exposed, and I have made this
class, or a collection thereof, the DataSource of the DataGrid. This neat
feature of the DataGrid allows the properties to be displayed in a
Collection of this class.

Now, how do I order the columns (not to be confused with the rows, which is managed by the collection)? Is there a simple process to do this, while
still using my simple class and not resorting to ADO.NET or XML? I would
prefer not to move to ADO.NET or XML, but if it's my only option I'd like to know.

Jon

Nov 15 '05 #11
Found the answer here:

http://support.microsoft.com/default...b;EN-US;317550

Jon

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I have a Windows Forms app in which I have a DataGrid control. I have a
custom class that has several properties exposed, and I have made this
class, or a collection thereof, the DataSource of the DataGrid. This neat
feature of the DataGrid allows the properties to be displayed in a
Collection of this class.

Now, how do I order the columns (not to be confused with the rows, which is managed by the collection)? Is there a simple process to do this, while
still using my simple class and not resorting to ADO.NET or XML? I would
prefer not to move to ADO.NET or XML, but if it's my only option I'd like to know.

Jon

Nov 15 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2447
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
3
2547
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
4
9636
by: yer darn tootin | last post by:
Does anyone know the sort expression for a column that's data has been returned in the format, eg '07 Jul 05'?? The sort expression {..:"dd mmm yy"} doesn't work ( if the column was returned as '07-Mar-05' the expression {..:dd-MMM-yy} works OK Second question, does anyone know hwo to return a date from SQL server in the format '07-Mar-05', as this would be a workaround. At the moment I'm using CONVERT(varchar(12),columnname,6 ) to...
1
2692
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, paginantion or accepting the add and remove item events. What i am observing is that none of the vents are happening... (Sort, page, or item). I am sure I am missing something basic here... Need help... Thanks much
4
1513
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 VB.NET) that handles the SortCommand event of the data grid. I've included the declaration of the Sub below. EnableViewState is set to false; we reload the DataSource each time the page posts. Would anyone know why this DataGrid doesn't sort? ...
4
2725
by: skOOb33 | last post by:
I successfully autosized the columns and rows on my Datagrid, and am now facing another issue. Having the sorting ability by clicking the column headers is key, but when I do that, it resizes all my rows back to their defaults. I populate the datagrid, resize it accordingly and it works fine...just when I click the headers is when it messes up. It would be fine if I could run my autosizing again after the sorting is done since there...
0
619
by: thomasp | last post by:
I have a datagridview that allows the user to sort the column by clicking on the header of the column the user wishes to sort. I did not code this, it had the ability when the datagrid was populated. My question is how can I chande the cursor to an hourglass when the user clicks the header and change it back to the default once the sort is accomplished. The database is large and the sort takes a few seconds. Need something to show the...
2
2795
by: Scott | last post by:
I am trying to sort a datagrid which contains 5 checkbox columns. All other columns sort properly except these 5 checkbox columns which dont sort at all. I am using ASP.NET 1.1 and this code is located in a user control. The code snippet for binding the checkbox control is as follows and is found in the ItemDataBound event for the datagrid. It appears that the index value never changes...it always seems to reference the orginal...
1
3782
by: Aeric | last post by:
I have read the following topic: sorting dataset and I am facing the same issue. I am designing a report. I have fill a dataset with the results from a query. From the results, I used to set the value from the items into an array and display on the aspx page in a table form. The reason why I don't use Datagrid or Gridview is because the table has to be design where the column headers has 2 or more rows and some columns need to be merged...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.