473,607 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Server Control Values Between Pages

Ok. So I'm passing values between web pages, as per microsoft's framework
development guide
(http://msdn.microsoft.com/library/de...-us/cpguide/ht
ml/cpconPassingSer verControlValue sBetweenPages.a sp)

So, I have two pages, one that has some public properties and fires a
Server.Transfer ("receivepage.a spx");

The receivepage.asp x can then get some of the public properties I've set on
the first page.

What I really want to be able to do is call the receivepage.asp x from a
variety of other pages. I am confused a little, because in the receivepage
you have to reference the sending page

i.e.

public sendingpage callPage;

private void Page_Load(objec t sender, System.EventArg s e)

{
if (!IsPostBack)

{

callPage = (sendingpage) Context.Handler ;

}

How can I dynamically choose which page I want to reference? Is it
possible? Thanks for any help.

= matt =
Nov 15 '05 #1
1 3030
Perfect. Thank you very much. I'm a little new to .NET and C# for that
matter, so I will do your first option. I'm not too clear on the "deriving
from a base class" part.

Thanks.

- matt -

"John Saunders" <jo***********@ surfcontrol.com > wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
"Matt M" <matt@remove_th is_core49.com> wrote in message
news:Yc******** *************** @news3.calgary. shaw.ca...
Ok. So I'm passing values between web pages, as per microsoft's framework development guide

(http://msdn.microsoft.com/library/de...-us/cpguide/ht
ml/cpconPassingSer verControlValue sBetweenPages.a sp)

So, I have two pages, one that has some public properties and fires a
Server.Transfer ("receivepage.a spx");

The receivepage.asp x can then get some of the public properties I've set

on
the first page.

What I really want to be able to do is call the receivepage.asp x from a
variety of other pages. I am confused a little, because in the

receivepage
you have to reference the sending page

...
How can I dynamically choose which page I want to reference? Is it
possible? Thanks for any help.


Matt, I may be misunderstandin g your question, and if so, please forgive

me.
The receiver page naturally cannot choose which page transferred to it.
However, it can determine which page transferred to it:

if (Context.Handle r is PageType1)
{
PageType1 pt1 = (PageType1) Context.Handler ;
// Reference pt1.Property
} else if (Context.Handle r is PageType2)
{
PageType2 pt2 = (PageType2) Context.Handler ;
// Reference pt2.Property
}
else
{
throw new Exception("I don't know what kind of page called me!");
}

You say you want to call the receiver from multiple pages. Do all the
"sending" pages have the same set of properties? If that's the case, you
might want to create a base page class which contains all of those
properties and then have the sending pages all derive from it. Your code in the receiving page would then be much simpler:

if (Context.Handle r is BaseSendingPage )
{
BaseSendingPage bsp = (BaseSendingPag e) Context.Handler ;
// Reference bsp .Property
}
else
{
throw new Exception("I don't know what kind of page called me!");
}
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com

Nov 15 '05 #2

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

Similar topics

2
4580
by: Gordon Hudson | last post by:
Hello Here is what I am trying to do: Make a hyperlink on a data entry form with its URL built from the values for fields in that entry on the database. So, I would go to record 65785 click on the link and it would open a web page. The URL contained in the hyperlink would pass the name and address field
6
364
by: Newbie | last post by:
How do I pass string values from one webform to another?
1
1286
by: Matt M | last post by:
Ok. So I'm passing values between web pages, as per microsoft's framework development guide (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/ht ml/cpconPassingServerControlValuesBetweenPages.asp) So, I have two pages, one that has some public properties and fires a Server.Transfer("receivepage.aspx"); The receivepage.aspx can then get some of the public properties I've set on the first page.
2
996
by: Greg Decos | last post by:
Hi, Any Idea how this can be done when the values to pass are part of a web control? Thanks Greg
4
1779
by: Miguel Dias Moura | last post by:
Hello, i created an ASP.net / VB page with a really big form. Now i want to create 4 pages and in each one i will place 1/4 of the big form. The last page will send all the form values by email. How can i send the form values from one page to the next one?
4
1596
by: gkr | last post by:
Hi I would like to pass values/data from Page1 to Page 2, then capture values on page 2 and return back to Page 1 with the values from page2. Can you pls guide me on how to do this ? I tried Server.transfer to pass values from Page1 to Page2, but from page2 am unable to return to Page 1 or any other page with the values picked from Page2.
1
2698
by: olduncleamos | last post by:
Hello all. With a background in ASP, I am finding the work required for passing values between pages mystifying. For various obvious reasons, I have eliminated using cookies and session to store state data. The only ASP.NET options left is to use the Server.Transfer to transfer to page 2 from page 1, and then use the context to get whatever values in page 1 from page 2. I do find this indeed a very elegant solution as now I can pass...
1
2334
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
4
3110
Vkas
by: Vkas | last post by:
HELLO!!!!!!!!!!!!! me using ASP.net 2.0, language VB.net! working tool Visula studio.Net 2005 I HAVE CREATED A simple WEB User control (calender.ascx) having a text box , a button, and a calender control
0
8050
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7987
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
8464
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6805
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
6000
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
3954
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
4015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2464
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
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.