In .aspx page,
<asp:TextBox ID="txtValue1" runat="server"></asp:TextBox>
<asp:TextBox ID="txtValue2" runat="server"></asp:TextBox>
<asp:Button ID="btnMultiply" runat="server" Text="Multiply" OnClick="btnMultiply_Click" />
<asp:TextBox ID="txtAnswer" runat="server" ReadOnly="true" Style="background-color: Gainsboro"></asp:TextBox>
In .aspx.cs page,
protected void btnMultiply_Click(object sender, EventArgs e)
{
if (txtValue1.Text == string.Empty || txtValue2.Text == string.Empty)
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Enter values in two textboxes')", true);
else
{
int value1 = Convert.ToInt32(txtValue1.Text);
int value2 = Convert.ToInt32(txtValue2.Text);
txtAnswer.Text = Convert.ToString(value1 * value2);
}
}
...........
@Nidhish