اسکریپت های جاوا اسکریپت :


<script>
function sumation(first,second,third)
{
first.value=parseInt(second.value)+parseInt(third. value);
}
</script>




کد های Html لازم :



<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="m_accepted_1" runat="server" Text="0"></asp:TextBox>+<asp:TextBox ID="f_accepted_1" runat="server" Text="0"></asp:TextBox>

<asp:TextBox ID="s_accepted_1" runat="server" ></asp:TextBox></div>
</form>
</body>



کد های سرور ساید :



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

f_accepted_1.Attributes.Add("onkeydown", "sumation(" + s_accepted_1.ClientID + "," + m_accepted_1.ClientID + "," + f_accepted_1.ClientID + ")")
f_accepted_1.Attributes.Add("onkeyup", "sumation(" + s_accepted_1.ClientID + "," + m_accepted_1.ClientID + "," + f_accepted_1.ClientID + ")")
m_accepted_1.Attributes.Add("onkeydown", "sumation(" + s_accepted_1.ClientID + "," + m_accepted_1.ClientID + "," + f_accepted_1.ClientID + ")")
m_accepted_1.Attributes.Add("onkeyup", "sumation(" + s_accepted_1.ClientID + "," + m_accepted_1.ClientID + "," + f_accepted_1.ClientID + ")")

End Sub


موفق باشی