Solved

can i change the order of my datagrid columns?

Posted on 2004-08-10
10
318 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
 

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
.xltm file opens as .xlsx file 3 37
asp.net bundle 8 36
Exception in Log4Net 1 19
How to Get total minutes between two hours 4 27
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now