0

i want to display text box value to another text box from one webpage to another in a button click. i know the windows code But don't know the web application.

public qus as form = new question()

qus.txtname=txtname.text
1
  • make use of session or querystring Commented Nov 21, 2013 at 5:23

3 Answers 3

2

On first page add button click event

Sub Btn_Click(sender As Object, _
                      e As EventArgs)

        Response.Redirect("SecondPage.aspx?id=" + txtname.text, false)

End Sub     

on second page set your text on page load.

Private Sub Page_Load(sender As Object, e As EventArgs)
   If Not IsPostBack
      SecondPageTextBox.Text = Request.QueryString("textValue").ToString()
   End If
End Sub 
Sign up to request clarification or add additional context in comments.

Comments

1

Use the query string to pass the text value to other page in the button click handler, like this:

Protected Sub Button1_Click(sender As Object, e As EventArgs)
    Response.Redirect("OtherPage.aspx?textValue='Value from other page'")
End Sub

Now in the Page_Load of the other page, pull the query string value out and assign it to the text box, like this:

Protected Sub Page_Load(sender As Object, e As EventArgs)
    If Request.QueryString("textValue") IsNot Nothing Then
        YourTextBox.Text = Request.QueryString("textValue").ToString()
    End If
End Sub

Comments

1

You have to write code on first page

Protected Sub Button1_Click(sender As Object, e As EventArgs)
    Response.Redirect("webpage2.aspx?textValue='value'")
End Sub

On second page

Private Sub Page_Load(sender As Object, e As EventArgs)
   If Not IsPostBack
      SecondPageTextBox.Text = Request.QueryString("textValue").ToString()
   End If
End Sub  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.