Referencing Dynamically Drop Down Lists/Creating Non-Literal Server ID Tags
Posted on 2004-08-16
Ok, so I've been trying to do this seemingly simple task for several hours now, but am just missing something huge. Here's the problem:
Basically, I just want to be able to create a runtime defined number of dropdown lists and be able to reference the values, but here's the full description:
I have a dynamic number of objects, each which need a drop down list from which I can get the value. The problem comes in being able to reference the lists.
I tried to create an array of DropDownLists, and then reference them in the web form. But, I am unable to reference them on the page since I cannot figure out how to reference a control in an array. I tried modifying the id tag to do so, but entering anything other than a string gives me parsing errors.
Similarly, I tried creating the objects directly in the page and adding the elements, but again I couldn't figure out how to reference the lists since I cannot assign anything other than a literal id (if someone could tell me how to modify the server id tag dynamically that would solve this problem nicely).
So now I am envisioning a set of state variables that get modified every time the list value changes, but this seems far too complicated for such a simple task.
So, any suggestions? I would, of course, be happy to provide code or answer any question.
Thanks in advance,