Groups | Blog | Home
all groups > dotnet distributed apps > december 2005 >

dotnet distributed apps : Generate Data Grid Columns Dynamically



andy
12/26/2005 7:51:02 PM
I have a datagrid that will display data from the database. Each user will
specify list of columns he wants to see and in the order he wants to see.
User A can specify that he wants to see only columns A,B,C and in the order
A,B,C and the user might say I want to see only only columns A,G,H but the
order should be
G,A,H. It's possible that column G might have a hyperlink.

How can I do it in Dot.Net? Any help will be appreciated.

Thanks,
Andy
Nishith Pathak
12/26/2005 9:25:02 PM
hi Andy,

To dynamically create the datagrid , you need to follow the steps as follows
1.Create a placeHolder in which your datagrid will reside
2. Instantiate the datagrid object in the code and then add it to
placeholder control
3. Set its AutoGenerate Property to false
4. Based on your requirements, instantiate the bound columns and add it to
columns property of the datagrid object.

Hope it helps

regards
Nishith Pathak
http://dotnetpathak.blogspot.com

[quoted text, click to view]
AddThis Social Bookmark Button