dcsimg
Results 1 to 3 of 3

Thread: How can I show the user input to another page in ASP.NET (in VB.NET)

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2019
    Posts
    2

    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.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,452

    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

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    1,944

    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
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal |Programming | GitHub
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

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
  •  



Featured


Click Here to Expand Forum to Full Width