Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to create datagridview with 3330+ columns. How can i achieve this???
Posted
Comments
Sergey Alexandrovich Kryukov 27-Dec-10 9:02am    
System.Windows.Forms or WPF?!!
Sergey Alexandrovich Kryukov 27-Dec-10 9:08am    
Are you sure they are columns, not rows? Ok, how many rows and columns, typically? Is it bound to database? Is so, how many database "columns"?
Sandeep Mewara 27-Dec-10 10:01am    
Columns?
OriginalGriff 27-Dec-10 10:30am    
Sandeep, even if it was rows I'd still say "don't do it" :laugh:
nitin bhoyate 1-Jan-11 6:25am    
Hey buddies laughing is good thing but just tell me how can i create datagridview with 3300+ COLUMNS.
Got it COLUMNS not rows.. IF YOU KNOW ANS THEN POST IT . Dont laugh .

Don't.

To put it in more detail: Don't do it. Think about it from a user point of view. How useful is a DGV with over 3000 columns? How long will it take a user to find the column he is interested in? Bearing in mind that a DGV column has a default width of 100 pixels, a screen running 1680 pixels wide will be able to show 16 columns at a time - then the user will have to scroll. Through all 200 horizontal pages.

Show them less info, but give them an option to see more detail for a particular row, preferably in a tabbed form with items logically grouped.
 
Share this answer
 
1.) you can rotate your data by exchange col and row index.
2.) you can group the data columns and transform it to a tree with columns.
happy new year ;) .
 
Share this answer
 
Comments
nitin bhoyate 1-Jan-11 6:26am    
thnks But i dont know how it should be achieved can you provide example..
Think about this, before you get yourself fired for incompetance.

Your display is, what, 1280 pixels wide? How many of those columns do you think you can show in 1280 pixels?

Who in their right mind would want to look through 3000+ columns of data??

Simple - it's a horrible idea that has no justifiable reason for existance.
 
Share this answer
 
You should make a custom grid for this, using , also i belive u want just store data and not display all 3k columns as output ?
 
Share this answer
 
Hi
You can create dynamci column shown as below.

DataTable dt = new DataTable();
for (int i = 0; i < 10; i++)
{
dt.Columns.Add(i.ToString());
}
for (int i = 0; i < 5; i++)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < 10; j++)
{
dr[j] = j;
}
dt.Rows.Add(dr);
}

GridView dv = new GridView();
dv.DataSource = dt;
dv.DataBind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900