I'm using asp.net vb and website is on client side. I have no idea how to perform this calculation. The website will set a payment plan. The time frame is 12 months and the minimum amount of a payment can be 25, but if they enter more than 25 is okay. 1. If the balance is less than 25 then a label will show them that they can't set pmt plan, but then if I change it to the amount of the balance, nothing happens and it still shows the error of the label and doesn't let me move on if I have it right. 2. How can I make sure the user stays in between guidelines or they cannot move on to the congratulations page? Below is my code but it doesn't work, my logic doesn't work. Can someone please help me with this. This is the default page:
<form id="form1" runat="server">
<div>
Enter balance<br />
<asp:TextBox ID="Balance" runat="server"></asp:TextBox>
<br />
Enter amount to pay<br />
<asp:TextBox ID="PmtAmount" runat="server" AutoPostBack="True"></asp:TextBox>
<br />
<asp:Label runat="server" ID="lblError" Text=""></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="submit" Width="90px" />
</div>
</form>
Code behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Page.IsPostBack Then
End If
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim pmt As Decimal
Dim bal As Decimal
Dim minpmt As Decimal
If Not Decimal.TryParse(Balance.Text, bal) OrElse _
Not Decimal.TryParse(PmtAmount.Text, pmt) Then
lblError.Visible = True
lblError.Text = "Balance and Payment Amount must be a decimal"
Else
If bal < 25.0 Then
lblError.Visible = True
lblError.Text = "You can't set a pymt plan, please pay in full"
ElseIf pmt < 25.0 Then
lblError.Visible = True
lblError.Text = "min is 25.00"
ElseIf bal > 300.0 Then
minpmt = bal / 12
lblError.Visible = True
lblError.Text = "your min pmt is " & Math.Round(minpmt, 2)
ElseIf pmt > (bal / 12) Then
Response.Redirect("default2.aspx")
End If
End If