viewstate question??

  • Thread starter Thread starter Greg Burns
  • Start date Start date
G

Greg Burns

A usercontrol and your page can both have the same named Viewstate item.
They will not collide, but they also will not be visible to each other.

What you can do is access the Page object's viewstate from the usercontrol.

Create a property (MyProperty) on your Page that returns/sets your
viewstate. Then in the usercontrol

Dim x as string = CType(Page, MyMasterPage).MyProperty

http://tinyurl.com/6vw5z

Greg
 
Hi
I have created a usercontrol in which I save a value in viewstate like this:
ViewState["myValue"]=value;
If I use the same key (ViewState["myValue"]=value;) in my master page, does
the framework recognize where the value comes from ? Or have I to set
ViewState["myValuefrommyusercontrol"]=value; and
ViewState["myValuefrommymasterpage"]=value; ?


Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top