sending data between two pages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ugur Ekinci

    sending data between two pages

    Hi all,

    I have two aspx pages, first one has a listbox and a button that opens popup
    aspx page. Popup page has listbox control ,
    so what i want to do is when I close the popup , the datas in popup's
    listbox will be sent to listbox of first aspx page,
    Any ideas ?

    Best regards...


  • S. Justin Gengo

    #2
    Re: sending data between two pages

    Ugar,

    There are three common ways to do this:

    1) Place the value to pass in the query string:
    http://www.mysite.com/page2.aspx?value=[yourvaluehere]
    Retrieve in page 2:
    Dim ValueToRetrieve As String = Request.Queryst ring("value")

    2) Place the value in a session variable:
    In page 1:
    Session.Items.A dd("ValueToPass ", [YourValueAsObje ctHere])

    In page 2:

    Dim ValueToRetrieve As String =
    Session.Items.I tem("ValueToPas s").ToString

    3) Store the value in the context object and then use Server.Transfer to to
    change pages.
    In page 1:
    Context.Items.A dd("ValueToPass ", [YourValueAsObje ctHere])
    Server.Transfer ("Page2.aspx ")

    In page 2:
    Dim ValueToRetrieve As String =
    Context.Items.I tem("ValueToPas s").ToString

    Of course you can pass any type of object in examples 2 and 3 but only
    singular objects like a string or int in example 1. Also example 2 requires
    a redirect be sent to the client browser in order to change pages while
    example 3 does not.

    In example 3 a Server.Transfer delivers page2 code to the client even though
    the client thinks it's getting pag1 code. What that means is that the client
    will still have page1.aspx in the addresss bar even though they will be
    seeing page2.aspx. But that won't affect your code. And the client sees your
    page faster because the redirect is skipped.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer



    "Out of chaos comes order."
    Nietzsche
    "Ugur Ekinci" <ugur@argeset.c om> wrote in message
    news:ON1$5Pu1FH A.1108@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Hi all,
    >
    > I have two aspx pages, first one has a listbox and a button that opens
    > popup aspx page. Popup page has listbox control ,
    > so what i want to do is when I close the popup , the datas in popup's
    > listbox will be sent to listbox of first aspx page,
    > Any ideas ?
    >
    > Best regards...
    >[/color]


    Comment

    Working...