Solved

can i change the order of my datagrid columns?

Posted on 2004-08-10
10
320 Views
Last Modified: 2010-04-15
i have a datagrid that has some dynamically created columns and some 'hard coded' columns. is there anyway that i can switch the order of columns at runtime?
0
Comment
Question by:trevoray
  • 5
  • 5
10 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767561
yeah, you can just move them in the column collection ...

MSDN:
"Note   The order that the columns are displayed in the DataGrid control is controlled by the order that the columns appear in the Columns collection. Although you can programmatically change the order of the columns by manipulating the Columns collection, it is easier to list the columns in the desired display order."
0
 

Author Comment

by:trevoray
ID: 11767670
can you show me how or where i can find out how to 'manipulate the Columb collection'?
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767676
win or web ?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:trevoray
ID: 11767731
web please.  c#
0
 

Author Comment

by:trevoray
ID: 11767740
i am basically interested in placing my 'hard-coded' column at the end of the column collection. but i also don't know how many dynamically created columns there will be, so that might be a problem. i'm sure there isn't something easy that just let's me 'make this column last'
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767745
nevermind I lied ... cant do it ...

Note   Explicitly declared columns may be used in conjunction with automatically generated columns. When using both, explicitly declared columns will be rendered first, followed by the automatically generated columns. Automatically generated columns are not added to the Columns collection.
0
 

Author Comment

by:trevoray
ID: 11767789
doah!!     :(
0
 

Author Comment

by:trevoray
ID: 11767794
last thing. can you give me the url that you quoted that comment from? then you'll get an easy 500  :)
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11767815
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767824
sorry :(
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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