473,503 Members | 12,516 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/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.

What I really want to be able to do is call the receivepage.aspx 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(object sender, System.EventArgs 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 3022
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**************@tk2msftngp13.phx.gbl...
"Matt M" <matt@remove_this_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/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.

What I really want to be able to do is call the receivepage.aspx 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 misunderstanding 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.Handler is PageType1)
{
PageType1 pt1 = (PageType1) Context.Handler;
// Reference pt1.Property
} else if (Context.Handler 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.Handler is BaseSendingPage)
{
BaseSendingPage bsp = (BaseSendingPage) Context.Handler;
// Reference bsp .Property
}
else
{
throw new Exception("I don't know what kind of page called me!");
}
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

Nov 15 '05 #2

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

Similar topics

2
4570
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...
6
364
by: Newbie | last post by:
How do I pass string values from one webform to another?
1
1283
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...
2
991
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
1776
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...
4
1592
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...
1
2689
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...
1
2329
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...
4
3104
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...
0
7296
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
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...
0
5604
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,...
1
5026
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...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
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 ...
1
751
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.