N
NewsMonkey
Hi Everyone,
I am using "Server.Transfer()" to send data to an ASP.NET page that's
sole purpose is to display messages. I am using "Server.Transfer since I
can set the contents of the message I want to display via the properties
of the page that is initiating the Server.Transfer() and also because
large amounts of data can be sent, such as a datagrid or other object.
Here is an example...
/* Sending Page (GenerateMessage.aspx) */
private string mMsg1 = "This is the first message";
private string mMsg2 = "This is the second message";
public string Message1
{
Get {return mMsg1;}
}
public string Message2
{
Get {return mMsg2;}
}
Server.Transfer("DisplayMessages.aspx");
/* Receiving Page (DisplayMessages.aspx) */
GenerateMessage objPage = (GenerateMessage)Context.Handler;
Response.Write("<B>" + objPage.Message1 + "</B>");
Response.Write("<B>" + objPage.Message2 + "</B>");
The question I am having is how can the "receiving page", in this case
"DisplayMessages.aspx", determine what the class of the sending page is
during runtime? I would like to be able to have the
"DisplayMessages.aspx" page accept messages from many different pages
but since I need to cast the Context.Handler object to the class of the
sending page it would seem that I would need to know the class name
ahead of time. Any suggestions? Thanks!
- DerekTheGeek
I am using "Server.Transfer()" to send data to an ASP.NET page that's
sole purpose is to display messages. I am using "Server.Transfer since I
can set the contents of the message I want to display via the properties
of the page that is initiating the Server.Transfer() and also because
large amounts of data can be sent, such as a datagrid or other object.
Here is an example...
/* Sending Page (GenerateMessage.aspx) */
private string mMsg1 = "This is the first message";
private string mMsg2 = "This is the second message";
public string Message1
{
Get {return mMsg1;}
}
public string Message2
{
Get {return mMsg2;}
}
Server.Transfer("DisplayMessages.aspx");
/* Receiving Page (DisplayMessages.aspx) */
GenerateMessage objPage = (GenerateMessage)Context.Handler;
Response.Write("<B>" + objPage.Message1 + "</B>");
Response.Write("<B>" + objPage.Message2 + "</B>");
The question I am having is how can the "receiving page", in this case
"DisplayMessages.aspx", determine what the class of the sending page is
during runtime? I would like to be able to have the
"DisplayMessages.aspx" page accept messages from many different pages
but since I need to cast the Context.Handler object to the class of the
sending page it would seem that I would need to know the class name
ahead of time. Any suggestions? Thanks!
- DerekTheGeek