Dear all,
i have totally four textboxes its allowing only double datatype values
while iam starting enter the values from first textbox onwords i want to disply the sum in the down lable
but this was in c# only dont need in javascript and j query
and after entering the first value and iam started to enter the second textbox value but i want sum update
so help me please

Ramchand RepallePosted Feb 4, 2015, 7:57 AM
You can use this event in C# windows or C# web applications in both.
Sample code should look like below for c# windows application.
private void textBox1_TextChanged(object sender, EventArgs e)
{
double txt1Value, txt2Value, total;
total = 0;
double.TryParse(textBox1.Text, out txt1Value);
double.TryParse(textBox2.Text, out txt2Value);
total = txt1Value + txt2Value;
label1.Text = total.ToString();
}
For C# web application code
protected void TextBox1_OnTextChanged(object sender, EventArgs e)
{
double txt1Value, txt2Value, total;
double.TryParse(TextBox1.Text, out txt1Value);
double.TryParse(TextBox2.Text, out txt2Value);
total = txt1Value + txt2Value;
lblDisplay.InnerText = total.ToString();
}
Prasad BhagatPosted Feb 4, 2015, 6:28 AM
iam asking for this calculation but in c# not in java script and jquery
Ramchand RepallePosted Feb 4, 2015, 5:46 AM
In that event sum up the other values (If textbox value is empty consider it as zero)
http://asp-net-example.blogspot.in/2009/03/how-to-use-ontextchanged-event-in.html
Thanks,
Ramchand