Passing values across webforms that use Master pages

C

Chad

Sorry to create a new thread on an old post but I didn't get a viable answer
and thought that the odds were against me getting one unless I started a new
thread.

My question was this:

I want to pass a string variable from default3.aspx to default2.aspx.

I create a property in default2.aspx, called "X", and assign a value. I then
call Server.Transfer("default3.aspx")

In default3.aspx I have this code:
Dim Default3 As Default3 = ctype(Context.Handler, Default3)
Dim PassedString As String = Default3.x

This will work fine as long a default 3 is not a webform that references a
master page.

If it is, it tells me that "Default 3" is an undefined type. As a result,
the only way that I know o get it to work is to turn of Option Strict and
change it to this:

Dim Default3 As Object = Context.Handler
Dim PassedString As String = Default3.x

I really dont want to turn off Option Strict or resort to looselt typed
variables.

How do I correct this?
 
G

Guest

Chad,
Try either putting the String name=value combo on the querystring, or into
the HttpContext.Current.Items Collection. Not reasonable to expect a
"property" of a page to survive a server.transfer or Response.Redirect.
Peter
 
C

Chad

Actually, it does work if you define Default3 as an Object. I was trying to
strongly type the variable Default3 as an object of type "Default3" and it
did not recognize the class "Defaulyt3" outside of the Default3 class.

Try it. It does work.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top