Assign GridView columns dynamically

C

cashdeskmac

Hi,

I have a GridView that is going to show data based on office opening and
closing times. I would like to look at the opening and closing time and the
length of the time slots (15 mins, 20 mins, etc) and create the columns
dynamically.

I thought about creating a GridViewRowCollection and assigning it to the
GridView.Rows collection, but the Rows collection is readonly, so that
approach is out.

Is there any other way to generate columns at runtime?
 
Y

YankeeImperialistDog

if you are trying to create cells dynamicly so that they are not even, row 1
has 5 cells, row two has 3 cells, ..., you will need to build them at run
time. If you are just generating a collection of rows that will change the
number of columns depending on the time of day look into creating a generic
list of objects and bind this to a gridview at run time.
 

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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top