?
Solved

can i change the order of my datagrid columns?

Posted on 2004-08-10
10
Medium Priority
?
324 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
[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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 total points
ID: 11767815
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767824
sorry :(
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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!
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 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