CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Location
    Brownsville, TX
    Posts
    5

    Unhappy how can I retrieve values of variables from one asp page to another??

    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?
    GabyGirl

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    You can either put them in the querystring or create session variables to hold the information.

  3. #3
    Join Date
    Mar 2002
    Location
    Alpharetta, GA
    Posts
    51
    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.

  4. #4
    Join Date
    Sep 2002
    Posts
    87
    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;
    }

  5. #5
    Join Date
    Mar 2002
    Location
    Alpharetta, GA
    Posts
    51
    Try this

    if (!IsPostback) {

    if (Context.Handler is FormOne) {
    fp = (FormOne)Context.Handler;
    }


    }

  6. #6
    Join Date
    Sep 2002
    Posts
    87

    Thumbs up Thank you

    Thankyou Mike its working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured