Link to home
Start Free TrialLog in
Avatar of trevoray
trevoray

asked on

can i change the order of my datagrid columns?

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?
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

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."
Avatar of trevoray
trevoray

ASKER

can you show me how or where i can find out how to 'manipulate the Columb collection'?
win or web ?
web please.  c#
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'
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.
doah!!     :(
last thing. can you give me the url that you quoted that comment from? then you'll get an easy 500  :)
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry :(