I'm giving int input in Textbox1 and Textbox2, then the sum of both will be display on Label1. Can anyone show me how it work??? My int.parse not working.
.asxp
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Display" />
</div>
.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MQM_System
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, System.EventArgs e)
{
int sum = 0;
sum = int.Parse(TextBox1.Text) + int.Parse(TextBox2.Text);
Label1.Text = sum.ToString();
}
}
}