This is a migrated thread and some comments may be shown as answers.

Filling some columns dynamically

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven Bixby
Top achievements
Rank 1
Steven Bixby asked on 28 Oct 2008, 07:00 AM
I've been poking around various forums and help pages for a couple hours now and I'm still not sure if or how I can do this:

I'm using a RadGrid  populating from a List<Obj> reference within my code;  I hook this up with NeedsDataSource event.  As long as all my columns reference actual properties in the object, everything is easy. 

However, I also have a set of values that can vary from one query to the next; the object has a collections property containing those values.  My data is read-only, so I don't need to worry about editing in the grid, at this time.

My grid's Columns collection contains a sufficient number of "generic" columns that are all marked visible=false; in my Page_Load, I can set column headers and the visible property for the custom columns.    Ideally, I'd love to be able to put something like "CollectionProperty[0]" in the DataField property for the column, but I don't think this is supported.  (I was hopeful, but alas!)

So then, my next thought is handling some kind of event that fires for every cell, with a reference to the underlying DataItem object that fills out the rest of the columns - I just determine which custom column is asking for data and return the correct indexed value from the collection property.

I can't seem to find such a beast, though - is there such an event?  I've hooked up a number of event handlers hoping to spot something like this, and scanned the documents for a couple of hours, and I haven't found anything.  Surely there's a reasonable way to do this?

1 Answer, 1 is accepted

Sort by
0
Steven Bixby
Top achievements
Rank 1
answered on 29 Oct 2008, 07:02 AM
"Never mind."

I found what I needed in ItemDataBound handler.
Tags
Grid
Asked by
Steven Bixby
Top achievements
Rank 1
Answers by
Steven Bixby
Top achievements
Rank 1
Share this question
or