-
Apr 8th, 2019, 08:45 AM
#1
Thread Starter
New Member
How can I show the user input to another page in ASP.NET (in VB.NET)
I have a page WebControls.aspx. I have some textBox in that page. I want to show that data in other page (Results.aspx) when the user click a button. I have this code but not working...
Code:
'WebControls.aspx
Private Sub WebControls_Load(sender As Object, e As EventArgs) Handles Me.Load
If IsPostBack Then
Dim firstName As String = firstNameTextBox.Text
Session.Add("Όνομα: ", firstName)
Session.Add("Επώνυμο: ", lastNameTextBox.Text)
Session.Add("E-mail: ", emailTextBox.Text)
Session.Add("Τηλέφωνο: ", phoneTextBox.Text)
Session.Add("Βιβλίο: ", booksDropDownList.SelectedItem.ToString)
Session.Add("Λειτουργικό Σύστημα: ", osRadioButtonList.SelectedItem.ToString)
'Dim ar As New ArrayList()
'ar.Add("Όνομα: " & firstNameTextBox.Text)
'ar.Add("Επώνυμο: " & lastNameTextBox.Text)
'ar.Add("E-mail: " & emailTextBox.Text)
'ar.Add("E-mail: " & phoneTextBox.Text)
'ar.Add("Βιβλίο: " & booksDropDownList.SelectedValue)
'ar.Add("Λειτουργικό Σύστημα: " & osRadioButtonList.SelectedValue)
'Session("InputData") = ar
End If
End Sub
'Results.aspx
Private Sub Results_Load(sender As Object, e As EventArgs) Handles Me.Load
For Each keyName In Session.Keys
outputLabel &= (keyName & Session(keyName))
Next
'Dim ar As New ArrayList()
'ar = Session("InputData")
'outputListBox.DataSource = ar
'outputListBox.DataBind()
End Sub
Last edited by Shaggy Hiker; Apr 8th, 2019 at 09:15 AM.
Reason: Added CODE tags.
-
Apr 8th, 2019, 09:18 AM
#2
Re: How can I show the user input to another page in ASP.NET (in VB.NET)
Welcome to the forum. I edited your post to wrap the code in [CODE][/CODE] tags, which you can do with the # button (either click it and paste the code between the tags, or paste the code, select it, then click the button). This improves formatting and readability...unusually. I also move the thread to the ASP.NET forum, which is likely to get you answers that are more on point, as the answer to that question is likely different in ASP.NET than in desktop programs.
My usual boring signature: Nothing
-
Apr 9th, 2019, 10:40 AM
#3
Re: How can I show the user input to another page in ASP.NET (in VB.NET)
I have this code but not working...
If outputLabel is a label control, use the Text property of the control to show the session values.
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (Session.Keys.Count > 0)
{
foreach (var keyName in Session.Keys)
{
outputLabel.Text += (keyName.ToString() + "-" + Session[keyName.ToString()] + " : ");
}
}
}
- kgc
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|