Hi itsjayshah,
As per your query i have create the sample.
Please check the below sample if you have any doubt you can revert my reply.
HTML
<div>
<table>
<tr>
<td>
Grand Total
</td>
<td>
<asp:TextBox ID="txtGrandTotal" runat="server" />
</td>
</tr>
<tr>
<td>
Enter The Percentage
</td>
<td>
<asp:TextBox ID="txtPercentage" runat="server" AutoPostBack="true" OnTextChanged="CalculateTaxAmount" />
</td>
</tr>
<tr>
<td>
TaxAmount
</td>
<td>
<asp:Label ID="lblTaxAmount" runat="server" Text="0"></asp:Label>
</td>
</tr>
</table>
</div>
C#
protected void CalculateTaxAmount(object sender, EventArgs e)
{
double totalAmount, taxAmount, grandTotal, percentage;
grandTotal = Convert.ToDouble(txtGrandTotal.Text);
percentage = Convert.ToDouble(txtPercentage.Text);
totalAmount = (grandTotal * 100) / (100 + percentage);
taxAmount = totalAmount * (percentage / 100);
lblTaxAmount.Text = Convert.ToString(Math.Round(taxAmount, 2));
}
VB.Net
Protected Sub CalculateTaxAmount(sender As Object, e As EventArgs)
Dim totalAmount As Double, taxAmount As Double, grandTotal As Double, percentage As Double
grandTotal = Convert.ToDouble(txtGrandTotal.Text)
percentage = Convert.ToDouble(txtPercentage.Text)
totalAmount = (grandTotal * 100) / (100 + percentage)
taxAmount = totalAmount * (percentage / 100)
lblTaxAmount.Text = Convert.ToString(Math.Round(taxAmount, 2))
End Sub