Reputation:

multiple usercontrols

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?

Upvotes: 0

Views: 435

Answers (1)

shahkalpesh
shahkalpesh

Reputation: 33476

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").

Upvotes: 2

Related Questions