Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple dynamically generated columns for DataGrids

Status
Not open for further replies.

TeaAddictedGeek

Programmer
Apr 23, 1999
271
US
Not sure if this is a C# or ASP.NET question--it'd depend on the solution.

I'm looking to find a way to make the datagrid bleed over into multiple columns. I'd create multiple datagrids but this needs to be dynamic as I won't know how many I need.

It'd be something like this, where you have multiple grid lists:


Foo1 ... Foo2 ... Foo3
Col1 Col2 Col3 ... Col1 Col2 Col3 ... Col1 Col2 Col3


I'm looking into things like repeaters but I've never seen them used with datagrids. Maybe someone here has some insights into solving this?


Thanks!

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
I'm not sure exactly what your problem is but it sounds like you should look into using nested GridView's or Repeaters.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
My problem is that I don't know how to create these different sets without hardcoding multiple datagrids per data type, and I can't do that as I won't ever know how many types there will be.

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
If what I was doing was a simple output of data, then yes. But the data display is dynamically controlled with checkboxes next to each entry.

I could also in theory just output the arraylist but dealing with things such as headers and the checkboxes would be an issue.

I'm honestly not certain if there is a simple solution to this. There may not be.

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Maybe what I need to do is use a DataList instead. Can you have dynamically generated column names and add checkboxes to those?

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Ok, I'm looking into it and I think you're right--GridView looks to be the way to go for something like this.

Just one question: can you repeat based upon data in the grid? Kinda like a sort, so if variable x changes it creates a new column?

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
That's great, but I was looking more of how versus possibility. :)

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Actually it looks like GridView doesn't allow for repeat of columns so it looks like I'm back to the DataList idea. Thanks anyhow!

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top