Solved

can i change the order of my datagrid columns?

Posted on 2004-08-10
10
322 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
Industry Leaders: 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 500 total points
ID: 11767815
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11767824
sorry :(
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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