This is very simple.
Let’s start with an example.
First, we take a label.
<asp:Label ID=”Label1″ runat=”server” Text=”Label”></asp:Label>
It has ID Label1.
Now take a textbox and button.
<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>
<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”Button” />
These two textbox and button also has ID TextBox1 and Button1.
Now we call a function on button click event.
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
}
Here we take text from textbox and set it to the label.
Question and answer is powered by AnsPress.io