Formatting GridView Columns Dynamically

D

Don Miller

I'd like to use a programmatically bound GridView to display a dataset (or
work with a datareader) that may include everchanging numbers of database
columns, in unpredictable order, with varying datatypes. I will be letting
end-users pick which columns to display and wonder how I could format
columns (e.g. centered vs. left-aligned, short-date vs. longdate format,
numbers vs. currency, etc.) depending on the datatype.

So, I know how to do this with fixed columns with GridView but I haven't a
clue on how to format columns and their contents dynamically. It seems I
could do this a lot easier with code that generates HTML dynamically as one
long string.

Any suggestions or tips on how I can do this? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top