Master Pages causing me grief

C

Chad

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?
 
A

Anthony Jones

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?
<<

This is group is for classic ASP for ASP.NET help try:-

microsoft.public.dotnet.framework.aspnet
 
E

Egbert Nierop \(MVP for IIS\)

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.

There is an object hierarchy, when you have a master page. So indeed,
define something as object and use this

Dim myPage as Object = Context.Handler

If (myPage is MasterPage) Then

'use subproperty to fetch the default3 page etc. I don't know yet
which one

Else

End If

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?
 

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

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top