Hi fahimahmed,
Check this example. Now please take its reference and correct your code.
HTML
<asp:TextBox runat="server" ID="txtUnitPriceLocal" Text="4434.3245494" />
<asp:DropDownList ID="ddlRoundDecimals" runat="server" OnSelectedIndexChanged="Round"
AutoPostBack="true">
<asp:ListItem Value="0" Text="Select" />
<asp:ListItem Value="1" Text="1" />
<asp:ListItem Value="2" Text="2" />
<asp:ListItem Value="3" Text="3" />
<asp:ListItem Value="4" Text="4" />
<asp:ListItem Value="5" Text="5" />
<asp:ListItem Value="6" Text="6" />
</asp:DropDownList>
<hr />
<asp:Label ID="lblUnitPriceLocal" runat="server" />
Code
C#
protected void Round(object sender, EventArgs e)
{
decimal UnitPriceLocal_Round = Convert.ToDecimal(txtUnitPriceLocal.Text);
UnitPriceLocal_Round = Math.Round(UnitPriceLocal_Round, int.Parse(ddlRoundDecimals.SelectedValue));
lblUnitPriceLocal.Text = UnitPriceLocal_Round.ToString();
}
VB.Net
Protected Sub Round(ByVal sender As Object, ByVal e As EventArgs)
Dim UnitPriceLocal_Round As Decimal = Convert.ToDecimal(txtUnitPriceLocal.Text)
UnitPriceLocal_Round = Math.Round(UnitPriceLocal_Round, Integer.Parse(ddlRoundDecimals.SelectedValue))
lblUnitPriceLocal.Text = UnitPriceLocal_Round.ToString()
End Sub
Screenshot