473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Passing values across webforms that use Master pages

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?




Jun 14 '06 #1
2 4063
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Chad" wrote:
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?




Jun 14 '06 #2
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.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:C2**********************************@microsof t.com...
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Chad" wrote:
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?




Jun 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Newbie | last post by:
How do I pass string values from one webform to another?
2
by: Jeremy | last post by:
How do I pass class object references between ASP.NET webforms ?
7
by: Jason | last post by:
We have a developer who claims the Visual Studio designer is not sophisticated enough to build enterprise grade web pages and thus hand codes all of his HTML in such a way as to make the designer...
13
by: anonymike | last post by:
Hello, I started working with the ObjectDataSource today. I have the select, and have been working on getting the update method to work. Here is the asp code for my Data source: ...
2
by: Chris Fink | last post by:
What is the recommendation for sharing master pages across IIS Servers? In our corporation, we have many webservers in different environments (intranet, extranet, etc). I've done some searching,...
3
by: Ily | last post by:
Hi I have two applications (both in asp.net 2.0). I want both to have a common company wide look and feel How can I do this using master pages? Also If new applications are added, I want...
2
by: jobs | last post by:
I've got a masterpage with a custom control that has a calendar. when dates on the calendar are selected, it sets a session variable. that calender is on every page via the master page. In the home...
1
by: Steve | last post by:
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...
1
by: Ily | last post by:
Hi all I have several applications that are all in asp.net 2.0 I want all of these applications to have a common look and feel. This inclues things like font, company logo, button colors etc ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.