Adding Dynamic Controls to a DataGrid for use with the built in DataGrid Edit/Update functionality

D

davidjgonzalez

(VS 2003, .NET 1.1)
I am trying to add dynamic controls to the cells of an Edit Row in a
DataGrid and am having a terrible time.
I cannot for the life of me get the values from the dynamic controls
after the page posts back on the DataGrid UpdateRow event.

When I create a dynamic control (these are almost always
dropdownlists), for example a States dropdownlist, i give the new
DropDownList object an ID: "DYNAMIC_CONTROL_States". I notice when i
view source on the Edit DataGrid webpage the DropDownList's ID in the
HTML is something like "DataGridName__ctl2_ct3_DYNAMIC_CONTROL_States".

In this case do i have to re-generate the States dropdownlist OnInit
with the ID "DYNAMIC_CONTROL_States" or
"DataGridName__ctl2_ct3_DYNAMIC_CONTROL_States".

Where do i regenrate them? in OnInit()? What does it take to regenerate
them?

DropDownList myStates = new DropDownList().
myStates.ID = DYNAMIC_CONTROL_States;

do i have to add the DropDownList items as well?
is there anything else I have to do to bind the postback value that is
floating around in the ViewState to this control?

Can I see the value without re-generating the control? (ViewState[]
doesnt have anything in it)

If anyone has _ANY_ insight into adding dynamic controls to DataGrids i
would very much like to hear it. as it stands this is killin me.

Also - has anyone ever seen this working before or suceeded in getting
dynamic controls IN A DATAGRID to postback values? I've read around 50
different articles and have seen anyone say they've suceeded with a
datagrid (they have managed to do it w/ standalone controls).

Thanks
 
D

davidjgonzalez

One last thing - my DataGrid has AutoGenerateColumns = true (so the
DataGrid can display any DataSource)
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top