473,402 Members | 2,061 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,402 software developers and data experts.

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 17 '05 #1
1 1281
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 17 '05 #2

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

Similar topics

2
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...
1
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...
6
by: Newbie | last post by:
How do I pass string values from one webform to another?
2
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
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...
5
by: Rod | last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and another by myself). In my ASP.NET pages, when saving data to a backend database I've done it by using the click event of a...
4
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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,...

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.