Applying [ViewStateModeById] functionality to standard, dynamic ASP.net controls
<p>I'm new to ASP.net, the ViewState, and C# in general.</p>

<p>I have some code that adds and deletes boolean constraints that will later be submitted as an SQL query. I dynamically create these constraints with unique IDs. When I delete a constraint earlier that was added before some other constraint, the viewstate tries to map the contents of the DropDownList that was deleted to the DropDownList immediately below it.</p>

<p>This is turn triggers an index changed event and causes undesirable behavior in the application. I'm fairly certain that this behavior is caused because the ViewState loads the postback data into dynamically created controls via index.</p>

<p>I've  been searching for a solution came across [ViewStateModeById] as a possible solution. Unfortunately, this seems to only to custom controls. I would like to avoid creating new custom controls for everything just to index the controls by ID. </p>

<p>Is there a way to gain this functionality without having creating custom controls?</p>

<p>I should mention that each dynamically generated constraint (which is a set of about 5 controls) is inside a dynamically generated panel. I could just keep creating empty panels as a sort of placeholder to get my desired behavior, but that is just a hack. I'll end up with many, many panels unless I implement another hack to occasionally delete some of my panels.</p>
