Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How / can I pass multiple values back to another page 3

Status
Not open for further replies.

bubberz

Programmer
Dec 23, 2004
117
US
Let's say I have four textbox values I want to pass back to another page. In the Response.Redirect string I have something now like
Response.Redirect("Page2.aspx?ID=" & txtbox.Text.ToString() & txtGroup.Text.ToString() & ddl1.SelectedValue.ToString() & " " & Mid(ddl2.SelectedItem.ToString)

How / can I pass the text box and ddl values separately?
Something like:
response.redirect("page2.aspx?txtbox=" & txtbox.Text.ToString() & ?ddl1=& ddl1.SelectedValue.ToString())

Do I have to use some special characters to separate them, look for that special character, then figure out with a Mid() to pull the string?
 
In Global.asax go to see the code.
Add:

Code:
Public Shared txt As String
Public Shared selValue As String

Before redirecting (or Server.Tranfer(...)) assign to these String Variables these:

Code:
txt = txtbox.Text
selValue = ...


-bclt
 
Thanks bclt!
Do I do the assignment on the page where the click event happens, or in the Global.asax page?
 
As they are Public Do the assignments in the click event!

Global.{VariableName} = value
 
All instances of the web applicaion will end up sharing that.
Global.selValue = Global.selValue & " hi"
Me.Label1.Text = Global.selValue
Open up three seperate browsers, navigate to each with the same page.
Number One will have "hi "
Number Two will have "hi hi "
Number Three will have "hi hi hi"

That is a good applicaion variable but not a session variable.

Try Session("MyVarFName")=txtFname.text
 
I may have missed something here but why can't you simple pass each one as a seperate querystring? e.g.
Code:
Response.Redirect("MyPage.aspx?T1=" & TextBox1.Text & "&T2=" & TextBox2.Text & "&DDL1=" & DropDownList1.SelectedItem.Value & "&DDL2=" & DropDownList2.SelectedItem.Value)
and then to show them on your other page you can just use:
Code:
    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
        Response.Write(Request.QueryString("T1") & "<br>")
        Response.Write(Request.QueryString("T2") & "<br>")
        Response.Write(Request.QueryString("DDL1") & "<br>")
        Response.Write(Request.QueryString("DDL2") & "<br>")
    End Sub

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Sweet! Thanks ca8msm! That's exactly what I was gettin' at!
Thanks again for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top