Professional Web Applications Themes

And Another: Passing variables from one page to the next. - ASP.NET General

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 ...

  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" <bethNOT-SO-bad-dawgs-in-ak.com> wrote in message
    news:Xns93D1783809A73bethNOTSObaddawgsina216.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. #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

  3. #3

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

    "Prakash R." <p_ramdashotmail.com> wrote in news:02e301c35df1$6bf8e100
    $a401280aphx.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

Similar Threads

  1. Passing Variables
    By LegeDoos in forum Macromedia Flash Data Integration
    Replies: 16
    Last Post: July 1st, 08:25 PM
  2. passing variables to new HTML page
    By Freek2004 in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 21st, 07:23 AM
  3. Passing Variables from swf to swf
    By vin-E in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: January 19th, 09:36 PM
  4. variables, passing again to another.
    By Louie Miranda in forum PHP Development
    Replies: 0
    Last Post: September 25th, 07:46 AM
  5. Replies: 3
    Last Post: August 1st, 07:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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