![]() |
Adding Dynamic Controls to a DataGrid for use with the built in DataGrid Edit/Update functionality
(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 |
Re: Adding Dynamic Controls to a DataGrid for use with the built in DataGrid Edit/Update functionality
One last thing - my DataGrid has AutoGenerateColumns = true (so the
DataGrid can display any DataSource) |
| All times are GMT. The time now is 11:49 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.