views:

31

answers:

1

I see a bunch of solutions about editing the template, but seeing as how my gridview changes between 10 different datasources a template isn't possible. Any idea of how I can accomplish this?

A: 

Handle the OnRowDataBound event and populate the cell yourself?

madcapnmckay
Something like: e.Row.Cells(1).Controls.Clear()then add the dropdown list and set it to the correct datasource?Any idea how I can identify the cell by its name?
Shawn
Is there a pattern that you can follow? If not then iterate throught the columns collection for the column of a particular name. Record the index and use that. Might want to cache the index for performance.
madcapnmckay
No pattern with that many datasources.
Shawn
I also only want the dropdown list to display when editing, so is onrowdatabound the correct event?
Shawn