And Another: Passing variables from one page to the next.

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: And Another: Passing variables from one page to the next.

    Here's a nice, simple way to pass values from one page to another:
    (VB.NET code)

    'Add data to the context object before transferring
    Context.Items("myParameter") = x
    Server.Transfer("WebForm2.aspx")

    Then, in WebForm2.aspx:

    'Grab data from the context property
    Dim x as Integer = CType(Context.Items("myParameter"),Integer)

    Of course there are a number of ways to pass values from one page to
    another, such as using the querystring, cookies, session,
    context, saving to a temporary table in the database between each page, etc.
    You'll have to decide which technique is best for your application.
    Here are several good articles on the subject to help you decide.
    [url]http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx[/url]

    [url]http://www.aspalliance.com/kenc/passval.aspx[/url]

    [url]http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600[/url]

    [url]http://www.dotnetbips.com/displayarticle.aspx?id=79[/url]

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Child" <beth@NOT-SO-bad-dawgs-in-ak.com> wrote in message
    news:Xns93D1783809A73bethNOTSObaddawgsina@216.168. 3.44...
    > I cannot for the life of me figure out how to get my identifying variable
    from one page to the
    > next. I am certain this is a stupid question.
    >
    > I tried setting a sesion variable and redirecting to the next page.
    >
    > session("orgid")=ddlorgs.selecteditem.value
    > response.redirect("edit_org.aspx")
    >
    > the session varible doesnt' exist. Perhaps I am misunderstanding the
    variable, but I
    > thought they were persistent across an entire session.
    >
    > Thank you all for your kindly and patient help.
    >
    >
    > --
    > BethF, Anchorage, AK
    >
    > It's YOUR God.
    > They are YOUR rules.
    > YOU burn in hell.

    Steve C. Orr, MCSD Guest

  2. Similar Questions and Discussions

    1. Passing Variables
      Hi there, I just managed to install apache2 webserver with php 4.3.8. I'm developing some php files. Previously I used an external webserver but...
    2. Passing variables from one swf to another
      I am facing problem to pass variable from one swf to another. I am using loadMovie to load another swf. how can I pass a variable value to another...
    3. Passing ASP Variables
      I have a form that submits to a SQL database. The table in SQL uses an identity field for the primary key called "entry". This is so I can get the...
    4. passing variables to new HTML page
      Im using a javascript search system combined with flash This actionscript is used in the button on (release, keyPress "<Enter>")...
    5. passing variables from first page to third
      I am new to the world of ASP, and at the same time VBscript (also a firt time poster). I am currently creating a multiple page form where the...
  3. #2

    Default And Another: Passing variables from one page to the next.

    Please post the code reading from session.

    With Regards
    Prakash R.
    >-----Original Message-----
    >I cannot for the life of me figure out how to get my
    identifying variable from one page to the
    >next. I am certain this is a stupid question.
    >
    >I tried setting a sesion variable and redirecting to the
    next page.
    >
    >session("orgid")=ddlorgs.selecteditem.value
    >response.redirect("edit_org.aspx")
    >
    >the session varible doesnt' exist. Perhaps I am
    misunderstanding the variable, but I
    >thought they were persistent across an entire session.
    >
    >Thank you all for your kindly and patient help.
    >
    >
    >--
    >BethF, Anchorage, AK
    >
    >It's YOUR God.
    >They are YOUR rules.
    >YOU burn in hell.
    >.
    >
    Prakash R. Guest

  4. #3

    Default Re: And Another: Passing variables from one page to the next.

    "Prakash R." <p_ramdas@hotmail.com> wrote in news:02e301c35df1$6bf8e100
    $a401280a@phx.gbl:
    > Please post the code reading from session.
    >

    SQLString="select * from tblOrgs where orgid = " & session("orgid")

    Thanks!

    --
    BethF, Anchorage, AK

    It's YOUR God.
    They are YOUR rules.
    YOU burn in hell.
    Child Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139