Passing multiple values using Response.Redirect

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

  1. #1

    Default Passing multiple values using Response.Redirect

    hie there, i want to be able to pass multiple parameters
    to another page. currently, i am able to do so, but
    somehow i feel it is not the correct way to do it. below
    is part of what i have so far.

    'first page
    Private Sub btnOK_ServerClick(ByVal sender As
    System.Object, ByVal e As System.EventArgs) Handles
    btnOK.Click
    Response.Redirect("InputValues.aspx?Requestor=" &
    txtRequestor.Text & " Lower= " & txtLower.Text)
    End Sub

    'second page
    Private Sub Page_Load(ByVal sender As System.Object, ByVal
    e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    Dim strRequestor As String
    strRequestor = Request.QueryString("Requestor")
    Response.Write("Requestor = " & strRequestor)
    End Sub

    the output i will get is :
    Requestor = * Lower = 10

    My question is, how can i pass the 2nd parameter(in the
    txtLower.Text) to the next page without passing the
    keyword "Lower" and still obtain the same output?

    i want my second page to look like this:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal
    e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    Dim strRequestor As String
    Dim strLower As String
    strRequestor = Request.QueryString("Requestor")
    Response.Write("Requestor = " & strRequestor)
    Response.Write("<br>")
    strLower = Request.QueryString("Lower")
    Response.Write(strLower)
    End Sub

    Please help, and thanx in advance.

    Anne Guest

  2. Similar Questions and Discussions

    1. Passing multiple session values from cold fusion into aflash movie
      Hello all, I know that to pass multiple variables into a flash movie you could use the embed tag like this(with the & between each variable): ...
    2. Response.Flush / Response.Redirect
      Hi, I've had a good google and can't find anything already on this so : I'm currently trying to have a 'Page Loading' page on a site. The way...
    3. passing variable with response.redirect
      I'm trying to retain a value that I pass to a processing page. When the page is done processing, I use the response.redirect to forward to the page...
    4. Passing multiple values accross a hyperlink ?
      Hi, I have a link as follows: <A HREF=""Tracker.asp?MovementID=" & RS("MovementID") & " PONumber=" & RS("PONumber") & """>" & RS("MovementID")...
    5. Redirect to New Browser Window like Response.Redirect
      That worked just fine for me as long as you put that open statement on one line rather than 2. "michel" <michely3k@yahoo.com> wrote in...
  3. #2

    Default Re: Passing multiple values using Response.Redirect

    Hi,

    You can use Server.Transfer("InputValues.aspx",true) to call the
    InputValues.aspx page with the Form and QueryString data.

    You can also take advantage of Context while using
    Server.Transfer("InputValues.aspx") and send any data that you want via
    Context.Items

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  4. #3

    Default Re: Passing multiple values using Response.Redirect

    hie natty. thanx 4 your reply. i've tried using your
    method, but i still do not get the output i wanted, that
    is how do i pass multiple parameters to the next page.
    Thanx!
    >-----Original Message-----
    >Hi,
    >
    >You can use Server.Transfer("InputValues.aspx",true) to
    call the
    >InputValues.aspx page with the Form and QueryString data.
    >
    >You can also take advantage of Context while using
    >Server.Transfer("InputValues.aspx") and send any data
    that you want via
    >Context.Items
    >
    >Natty Gur, CTO
    >Dao2Com Ltd.
    >28th Baruch Hirsch st. Bnei-Brak
    >Israel , 51114
    >
    >Phone Numbers:
    >Office: +972-(0)3-5786668
    >Fax: +972-(0)3-5703475
    >Mobile: +972-(0)58-888377
    >
    >Know the overall picture
    >
    >
    >*** Sent via Developersdex [url]http://www.developersdex.com[/url]
    ***
    >Don't just participate in USENET...get rewarded for it!
    >.
    >
    Anne Guest

  5. #4

    Default Re: Passing multiple values using Response.Redirect

    Hi,
    The calling page :
    Context.Items.Add("DataA","yourData");
    Context.Items.Add("ObjectData",System.DateTime.Now );

    the target page :

    string StringData = (string)Context["DataA"];
    System.DateTime oDateTime = (System.DateTime)Context["ObjectData"]


    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  6. #5

    Default Passing multiple values using Response.Redirect

    First method:

    If you are using the request.querystring use "&" between
    the values

    Response.Redirect("InputValues.aspx?Requestor=" &
    txtRequestor.Text & "&Lower= " & txtLower.Text)

    InputValues.aspx page retrieve the values:

    strRequestor = Request.QueryString("Requestor")
    Response.Write("Requestor = " & strRequestor)

    strLower = Request.QueryString("Lower")
    Response.Write("Lower = " & strLower)

    Second Method:

    Use session Variables if you don't want to display these
    values in the header

    on page 1
    session("Requestor")=txtRequestor.Text
    Session("Lower")=txtlower.text
    response.redirect("InputValues.aspx")

    In the InputValues.aspx page
    strRequestor=session("Requestor")
    strLower=Session("Lower")
    Session("Requestor")=nothing
    Session("Lower")=nothing

    Hope that helps.
    >-----Original Message-----
    >hie there, i want to be able to pass multiple parameters
    >to another page. currently, i am able to do so, but
    >somehow i feel it is not the correct way to do it. below
    >is part of what i have so far.
    >
    >'first page
    >Private Sub btnOK_ServerClick(ByVal sender As
    >System.Object, ByVal e As System.EventArgs) Handles
    >btnOK.Click
    > Response.Redirect("InputValues.aspx?Requestor=" &
    > txtRequestor.Text & " Lower= " & txtLower.Text)
    >End Sub
    >
    >'second page
    >Private Sub Page_Load(ByVal sender As System.Object,
    ByVal
    >e As System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > Dim strRequestor As String
    > strRequestor = Request.QueryString("Requestor")
    > Response.Write("Requestor = " & strRequestor)
    >End Sub
    >
    >the output i will get is :
    >Requestor = * Lower = 10
    >
    >My question is, how can i pass the 2nd parameter(in the
    >txtLower.Text) to the next page without passing the
    >keyword "Lower" and still obtain the same output?
    >
    >i want my second page to look like this:
    >
    >Private Sub Page_Load(ByVal sender As System.Object,
    ByVal
    >e As System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > Dim strRequestor As String
    > Dim strLower As String
    > strRequestor = Request.QueryString("Requestor")
    > Response.Write("Requestor = " & strRequestor)
    > Response.Write("<br>")
    > strLower = Request.QueryString("Lower")
    > Response.Write(strLower)
    >End Sub
    >
    >Please help, and thanx in advance.
    >
    >.
    >
    makthar Guest

  7. #6

    Default Re: Passing multiple values using Response.Redirect

    Do you HAVE to use the 2nd page. Sometimes it's best to do the processing
    in a single page...

    Assuming you have to do it that way,
    why not use Session to transfer the data. Just clean up after yourself on
    the 2nd page by removing the values after you extract the values.




    "Natty Gur" <natty@dao2com.com> wrote in message
    news:eOKb3vDRDHA.3700@tk2msftngp13.phx.gbl...
    > Hi,
    >
    > You can use Server.Transfer("InputValues.aspx",true) to call the
    > InputValues.aspx page with the Form and QueryString data.
    >
    > You can also take advantage of Context while using
    > Server.Transfer("InputValues.aspx") and send any data that you want via
    > Context.Items
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    >

    David Waz... Guest

  8. #7

    Default Passing multiple values using Response.Redirect

    hie makthar! thanx a lot 4 your help. it solved my prob! :)

    >-----Original Message-----
    >First method:
    >
    >If you are using the request.querystring use "&" between
    >the values
    >
    >Response.Redirect("InputValues.aspx?Requestor=" &
    > txtRequestor.Text & "&Lower= " & txtLower.Text)
    >
    >InputValues.aspx page retrieve the values:
    >
    > strRequestor = Request.QueryString("Requestor")
    > Response.Write("Requestor = " & strRequestor)
    >
    > strLower = Request.QueryString("Lower")
    > Response.Write("Lower = " & strLower)
    >
    >Second Method:
    >
    >Use session Variables if you don't want to display these
    >values in the header
    >
    >on page 1
    >session("Requestor")=txtRequestor.Text
    >Session("Lower")=txtlower.text
    >response.redirect("InputValues.aspx")
    >
    >In the InputValues.aspx page
    >strRequestor=session("Requestor")
    >strLower=Session("Lower")
    >Session("Requestor")=nothing
    >Session("Lower")=nothing
    >
    >Hope that helps.
    >>-----Original Message-----
    >>hie there, i want to be able to pass multiple parameters
    >>to another page. currently, i am able to do so, but
    >>somehow i feel it is not the correct way to do it. below
    >>is part of what i have so far.
    >>
    >>'first page
    >>Private Sub btnOK_ServerClick(ByVal sender As
    >>System.Object, ByVal e As System.EventArgs) Handles
    >>btnOK.Click
    >> Response.Redirect("InputValues.aspx?Requestor="
    &
    >> txtRequestor.Text & " Lower= " & txtLower.Text)
    >>End Sub
    >>
    >>'second page
    >>Private Sub Page_Load(ByVal sender As System.Object,
    >ByVal
    >>e As System.EventArgs) Handles MyBase.Load
    >> 'Put user code to initialize the page here
    >> Dim strRequestor As String
    >> strRequestor = Request.QueryString("Requestor")
    >> Response.Write("Requestor = " & strRequestor)
    >>End Sub
    >>
    >>the output i will get is :
    >>Requestor = * Lower = 10
    >>
    >>My question is, how can i pass the 2nd parameter(in the
    >>txtLower.Text) to the next page without passing the
    >>keyword "Lower" and still obtain the same output?
    >>
    >>i want my second page to look like this:
    >>
    >>Private Sub Page_Load(ByVal sender As System.Object,
    >ByVal
    >>e As System.EventArgs) Handles MyBase.Load
    >> 'Put user code to initialize the page here
    >> Dim strRequestor As String
    >> Dim strLower As String
    >> strRequestor = Request.QueryString("Requestor")
    >> Response.Write("Requestor = " & strRequestor)
    >> Response.Write("<br>")
    >> strLower = Request.QueryString("Lower")
    >> Response.Write(strLower)
    >>End Sub
    >>
    >>Please help, and thanx in advance.
    >>
    >>.
    >>
    >.
    >
    Anne Guest

  9. #8

    Default Re: Passing multiple values using Response.Redirect

    thanx david 4 your suggestion. appreciate it very much.
    >-----Original Message-----
    >Do you HAVE to use the 2nd page. Sometimes it's best to
    do the processing
    >in a single page...
    >
    >Assuming you have to do it that way,
    >why not use Session to transfer the data. Just clean up
    after yourself on
    >the 2nd page by removing the values after you extract the
    values.
    >
    >
    >
    >
    >"Natty Gur" <natty@dao2com.com> wrote in message
    >news:eOKb3vDRDHA.3700@tk2msftngp13.phx.gbl...
    >> Hi,
    >>
    >> You can use Server.Transfer("InputValues.aspx",true) to
    call the
    >> InputValues.aspx page with the Form and QueryString
    data.
    >>
    >> You can also take advantage of Context while using
    >> Server.Transfer("InputValues.aspx") and send any data
    that you want via
    >> Context.Items
    >>
    >> Natty Gur, CTO
    >> Dao2Com Ltd.
    >> 28th Baruch Hirsch st. Bnei-Brak
    >> Israel , 51114
    >>
    >> Phone Numbers:
    >> Office: +972-(0)3-5786668
    >> Fax: +972-(0)3-5703475
    >> Mobile: +972-(0)58-888377
    >>
    >> Know the overall picture
    >>
    >>
    >> *** Sent via Developersdex [url]http://www.developersdex.com[/url]
    ***
    >> Don't just participate in USENET...get rewarded for it!
    >>
    >
    >
    >.
    >
    Anne 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