Author: rkeslar | Posted on: 2/25/2009 8:21:47 AM | Views : 326

Hi, when a user clicks 'Add Row' on my page a row of controls are created dynamically in the code behind. First on the page load, I have a call to CreateDynamicControls(null) which creates the controls. Inside CreateDynamicControls, I have a dropdownlist with autopostback=true. On the SelectedIndexChanged method of this dropdownlist, I take whatever id was selected, and then call CreateDynamicControls, this time passing the value from the dropdownlist in. So CreateDynamicControls is called a second time and this time is supposed to populate another dropdownlist based on the value passed in. The problem I'm having is that each time it's called, in my for loop, the value is reset to 0, and since CreateDynamicControls is called twice, I have controls having the same name. I don't know what to do about this. Here is what I have.

 HiddenField1 is a hidden field in the aspx Go to the complete details ...