Thursday, March 29, 2012

Passing values between pages with MasterPages

After a few hours of trial and error I have reached the following
conclusions, can you please tell me if I am right:
I have 2 aspx pages both with the same master page and I wish to pass
values from one to the other.
1. The postbackurl method doesn't seem to work with master pages. If I
take away the master pages it works.
2. The server.transfer method also doesn't work if I try to acess the
values via Request.Form or PreviousPage.FindControl. Again if I take
away the master pages it works.
3. My only option if I don't want to use the querystring to pass the
values (i.e. response.redirect) is to use a method which stores the
values in the server's RAM. e.g use Context.Items in conjunction with
Server.Transfer. This works with MasterPages but has the downfall of
the server's RAM now being used.
Please tell me if I am wrong or if there is no way of using cross page
posting or server.transfer for passing values from one aspx page with a
masterpage to another with the same masterpage without storing the
values in RAM?
Kind regards,
Steve."Steve" wrote:
> I have 2 aspx pages both with the same master page and I wish to pass
> values from one to the other.
Try using session variables, which should persist across page requests at a
user level:
1)
Session("SettingName") = strSettingValue
2)
strSettingValue = CStr(Session("SettingName"))

0 comments:

Post a Comment