ASP.net dynamic controls issue when trying to reverse them
Posted
by Mattias Sandsäter
on Stack Overflow
See other posts from Stack Overflow
or by Mattias Sandsäter
Published on 2010-04-15T15:11:49Z
Indexed on
2010/04/15
15:13 UTC
Read the original article
Hit count: 374
ASP.NET
I add some DropDownList dynamically to my form. It seems to work as it should when I use ...Controls.Add(dropdownlist), but in an attempt to turn them around and show them in reversed order I have tried to use ....Controls.AddAt(0, dropdownlist) However, this causes some strange behaviour.
Before we dig in to the code, is there something I should know about dynamic adding, and more specific the AddAt()-method that usually causes trouble?
Short description about what I do
I start with a DropDownList (level1), when I choose something there, a new list should be added (level2) and so on. You can say you go your way down in a menu structure. Whenever you want you can change your choice at whatever level you want (of course not on later levels that you dont see yet). So lets say you are down to level 4 (You then have four boxes) and change your choice at level1, when the page reloads you are back to two boxes.
http://forums.asp.net/p/885886/927411.aspx
It seems that my problem was discussed here, but I didn´t see any solution about how I can acheive my intended behaviour.
© Stack Overflow or respective owner