Hi There,
I have about 20 div's in an aspx page. At any time, only one of them will be visible. I need to decide which div to show depending on the Query String.
http://...?mode=<ModeName>
The easy way would be to start with all div's invisible, then just put the QueryString in switch and write out cases for all the possible ModeNames (or get it in a big if-else structure)
I dont really like hard coding things because if in future if I add/remove any div then I need to "remember" to do the necessary changes in the places that toggle divs.
I was thinking of creating an enum with all names and passing that enum to the function so I can iterate through all enums and set visibility accordingly. This way I only need to add the div name in the top enum declaration. But it did not quite work out that way (probably I'm too fiddly to get it to work)
Is Switch block my only way out of this? Does anyone have a better way to do this? Thanks in advance!