Hi Akhter,
Please refer below sample.
HTML
<table>
<tr>
<td>Weight</td>
<td><asp:TextBox ID="txtWeight" runat="server" onkeyup="multiply()"></asp:TextBox></td>
<td>* Rate</td>
<td><asp:TextBox ID="txtrate" runat="server" onkeyup="multiply()"></asp:TextBox></td>
<td>+ Freight</td>
<td><asp:TextBox ID="txtfrghtamt" runat="server" onkeyup="multiply()"></asp:TextBox></td>
<td>/ To Weight</td>
<td><asp:TextBox ID="txtWeightto" runat="server" onkeyup="multiply()"></asp:TextBox></td>
<td>Total</td>
<td><asp:TextBox ID="txtvalue" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="10" style="text-align: center">
<asp:Button Text="Save" runat="server" OnClick="Save" /></td>
</tr>
</table>
<script type="text/javascript">
function multiply() {
var txt1 = document.getElementById('<%= txtWeight.ClientID %>').value;
var txt2 = document.getElementById('<%= txtrate.ClientID %>').value;
var txt3 = document.getElementById('<%= txtfrghtamt.ClientID %>').value;
var txt4 = document.getElementById('<%= txtWeightto.ClientID %>').value;
if (isNaN(txt1) || txt1 == "") {
txt1 = "0";
}
if (isNaN(txt2) || txt2 == "") {
txt2 = "0";
}
if (isNaN(txt3) || txt3 == "") {
txt3 = "0";
}
if (isNaN(txt4) || txt4 == "") {
txt4 = "1";
}
var result = ((parseFloat(txt1) * parseFloat(txt2)) + parseFloat(txt3)) / parseFloat(txt4);
var rstTxtbox = document.getElementById('<%= txtvalue.ClientID %>');
rstTxtbox.value = result;
}
</script>
Code
C#
protected void Save(object sender, EventArgs e)
{
string total = txtvalue.Text;
// Use the total variable to save in database.
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('" + total + "');", true);
}
VB.Net
Protected Sub Save(ByVal sender As Object, ByVal e As EventArgs)
Dim total As String = txtvalue.Text
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('" & total & "');", True)
End Sub
Screenshot