Hello, Is there anyway one can access variables from one asp page to another? If there is not, how can one access those variables without having to use a form?
Hello, Is there anyway one can access variables from one asp page to another? If there is not, how can one access those variables without having to use a form?
You can either put them in the querystring or create session variables to hold the information.
http://msdn.microsoft.com/library/de...tweenpages.asp
Don't worry about the page template @reference directives. All you need to do is get a handle to IContextHandler in the code behind of the target page and cast it to the page that is sending the values.
You'll see what I'm talking about after you read this article. It sounds complicated but its really easy and not as annoying as session variables and query string parameters.
Hi Mike
I applied your suggested technique, it worked.
But when i try to access the second page by providing its url
it gives following error message.
...................................................................
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
if (!IsPostBack)
{
fp=(FormOne) Context.Handler;
}
Try this
if (!IsPostback) {
if (Context.Handler is FormOne) {
fp = (FormOne)Context.Handler;
}
}
Thankyou Mike its working now.