473,804 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.H andler, 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 4081
Chad,
Try either putting the String name=value combo on the querystring, or into
the HttpContext.Cur rent.Items Collection. Not reasonable to expect a
"property" of a page to survive a server.transfer or Response.Redire ct.
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.H andler, 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*******@yaho o.nospammin.com > wrote in message
news:C2******** *************** ***********@mic rosoft.com...
Chad,
Try either putting the String name=value combo on the querystring, or into
the HttpContext.Cur rent.Items Collection. Not reasonable to expect a
"property" of a page to survive a server.transfer or Response.Redire ct.
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.H andler, 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
364
by: Newbie | last post by:
How do I pass string values from one webform to another?
2
1416
by: Jeremy | last post by:
How do I pass class object references between ASP.NET webforms ?
7
1571
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 impossible to use. Is this common?
13
8232
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: <asp:ObjectDataSource ID="dsourceApps" runat="server" SelectMethod="getAllApplications" TypeName="AppMgr.AppManager" UpdateMethod="updateAppHdr" ConflictDetection="CompareAllValues"
2
2745
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, and it appears as though the solutions are focused only around one IIS instance, by installing the controls (master pages) in the GAC. This solution would require me to install the controls in more than 1 dozen servers each time.... I would think...
3
1965
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 them to have the company wide look and feel, but with the minimum of work? Is this 'do-able'?
2
2197
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 page, that session variable is used as a param for a grdiview where eventlog records for the day are displayed. The gridview is on the homepage under a content tag. In data input web form pages, we use that calendar as a datepicker for date...
1
2346
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 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
1
1046
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 How can I achive this using master pages as so far I have only found ways of doing this for a single application - but I want to do this for several applications. The idea is that if I develop a new application
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.