tomouse
Technical User
- Aug 30, 2010
- 50
Hello,
I have 3 different types of dynamically added User Control on my page (flight, hotel, hire car). To each of these, a travel agent can add multiple "Options" - each option is a dynamically added user control. The Options sit within an "Option Container" - the idea being that I can have one generic Option Container control that I can drop onto all my Flights, Hotels, Hirecars.
Because these are dynamic controls I am persisting their values using ViewState. What I want to know is, does each Option Container need to use a uniquely named ViewState? Or is the scope of viewstate for each control restricted to that control? There may be multiples of each control on the page simultaneously.
It would be nice if I could just use a generic name for all of them (e.g. ViewState("vsOptionIDs"), but if they are going to interfere with each other then that is obviously no good! In which case, are there any handy methods? I guess you could make a custom 'viewstatename' property of the container and append the container's ID to a standard string?:
I have 3 different types of dynamically added User Control on my page (flight, hotel, hire car). To each of these, a travel agent can add multiple "Options" - each option is a dynamically added user control. The Options sit within an "Option Container" - the idea being that I can have one generic Option Container control that I can drop onto all my Flights, Hotels, Hirecars.
Because these are dynamic controls I am persisting their values using ViewState. What I want to know is, does each Option Container need to use a uniquely named ViewState? Or is the scope of viewstate for each control restricted to that control? There may be multiples of each control on the page simultaneously.
It would be nice if I could just use a generic name for all of them (e.g. ViewState("vsOptionIDs"), but if they are going to interfere with each other then that is obviously no good! In which case, are there any handy methods? I guess you could make a custom 'viewstatename' property of the container and append the container's ID to a standard string?:
Code:
private viewstatename as string = "vsOptContainer" & me.id