|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
LoadControl and Multiple IDs in UserControls ErrorI have a usercontrol to load dynamically into a webform. In the usercontrol there is a textbox. I need to load 2 instants of the same usercontrol into the form. When a command button, which resides on the form container, is clicked. The text content in the two different instants of the user control should be retrieved... Loading the form into the webform seems ok, but when i click on the button, I get this error Multiple controls with the same ID '(id of the control)' were found. FindControl requires that controls have unique IDs. How do I get around this? thanks. Nestor. add the id's to the textbox's dynamicly
u can use dim i as int32 = 0 for each control in dynamicControls dim myControlId as String = "myControlId" & i.ToString myTextBox.Attrbuites.Add("id", myControlID) Next the above is just a quick bit of code i typed out of my head, so it may not be 100% correct, but it should give the idea of how to dynamiclly set the Control ID's Show quoteHide quote "Nestor" wrote: > Hello, > > I have a usercontrol to load dynamically into a webform. In the usercontrol > there is a textbox. I need to load 2 instants of the same usercontrol into > the form. > > When a command button, which resides on the form container, is clicked. The > text content in the two different instants of the user control should be > retrieved... > > Loading the form into the webform seems ok, but when i click on the button, > I get this error > > Multiple controls with the same ID '(id of the control)' were found. > FindControl requires that controls have unique IDs. > > How do I get around this? > > thanks. > Nestor. > > >
Finding a way to bind ASP.NET controls(two way) to a typed-dataset
Error in DataList test query - aspnet 2.0 Gridview Updates not writing to database after clicking update Datagrid paging I lose my sort Postback in Web Controls client-side .NET control Coloring Calendar !!! Status text FormView DataBinding in Insert mode DropDownList |
|||||||||||||||||||||||