How can I used if (IsPostBack){}
to display user's names from two text boxes into another text box?
I have 3 text boxes and a button. The text boxes are named txtLastName, txtGivenName, txtOutput. My button is btnSubmit.
How can I display text from the txtLastName and txtGivenName in the txtOutput text box?
How can I display it as: First (space) Lastname or Last, Firstname in this code.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
}
}
Create an event handler for the Click event on the button and then in the code behind, do like this:
protected void btnSubmit_Click(object sender, EventArgs e)
{
txtOutput.Text = string.Format("{0} {1}", txtGivenName.Text, txtLastName.Text);
}