Hi,
Let's say we have 2 usercontrols uc1 and uc2 in a Page. I set the Viewstate["name"]="John" in uc1. How do I access this Viewstate["name"] in uc2 control?
Hi,
Let's say we have 2 usercontrols uc1 and uc2 in a Page. I set the Viewstate["name"]="John" in uc1. How do I access this Viewstate["name"] in uc2 control?
You could create a public property on UC1 which can read/write the ViewState data you are trying to set & access UC1's property from UC2.
See here for an example of property backed by Control's ViewState.
From UC2, you could get a reference of UC1 by Page.Controls("myUC1Control")
or using Page.FindControl("myUC1Control")
.