Make use of javascript to calculate the values.
Here is piece of example make use of this. i have used
txtsubject1
txtsubject2
txtsubject3
to calculate txtTotal.
I have used the onBlur event in the textbox so that when the focus is out from the textbox the calculate function will be called.
This is my code in aspx page.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type = "text/javascript">
//This is the javascript function which will calulate the total
function calculate() {
var sub1 = document.getElementById('txtSubject1').value; // specify the subject1 text box id value
var sub2 = document.getElementById('txtSubject2').value; // specify the subject2 text box id value
var sub3 = document.getElementById('txtSubject3').value; // specify the subject3 text box id value
if (sub1 == '') sub1 = 0;
if (sub2 == '') sub2 = 0;
if (sub3 == '') sub3 = 0;
var total = parseInt(sub1) + parseInt(sub2) + parseInt(sub3);
document.getElementById('txtTotal').value = total;
}
</script>
</head>
<body onload="OnSuccess();">
<form id="form1" runat="server">
<asp:Panel runat="server" id="Panel2" style="display:block; width:718px;" >
<tr>
<tr>
<td class="style1" style="width: 281px"> subject1:
<asp:TextBox ID="txtSubject1" runat="server" onBlur="return calculate();" ></asp:TextBox>
</td>
<td style="width: 458px">
<br />
subject2:
<asp:TextBox ID="txtSubject2" runat="server" onBlur="return calculate();" ></asp:TextBox>
</td>
<td style="width: 458px">
<br />
subject3:
<asp:TextBox ID="txtSubject3" runat="server" onBlur="return calculate();" ></asp:TextBox>
</td>
<td style="width: 458px">
<br />
Total:
<asp:TextBox ID="txtTotal" runat="server"></asp:TextBox>
</td>
</tr>
</td>
</tr>
</asp:Panel>
</form>
</body>
</html>