Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Modifying Page ViewState in a Method
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00946814
Message ID:
00946867
Vues:
16
>The Page ViewState is a protected property so I do not see a way to pass a reference to the Page to a method in another assembly and modify the ViewState. I have a scenario in which I would like to do this. Is this a "duh!" situation in which I am missing something here or are we restricted to modifying the Page ViewState within methods in the Page itself?

Bill,

Below is an example of how to setup such a routine in VB.net ... I'm not for sure what the syntax would be in C#, but I bet Kevin or Bonnie would know.
Public Sub RoutineName(ByRef pgSender As System.Web.UI.Page)
	pgSender.ViewState("Test") = 1
End Sub
The important key there is ByRef so that you modify the ViewState of that page rather than a temp copy of the page.

Hope that helps...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform