Hi kankon,
1. The TextBox with ID EmergencyTotalPointsTextBox1 not present in the page.
2. You can't apply greater than symbol between string and integer.
3. You can't increment or decrement string value.
You have interger value on both left and right hand side.
Refer below example.
HTML
<asp:TextBox runat="server" ID="EmergencyMonthPointsTextBox1" />
<asp:TextBox runat="server" ID="EmergencyTotalPointsTextBox1" />
<br />
<asp:Button Text="-" runat="server" OnClick="Button71_Click" />
<asp:Button Text="+" runat="server" OnClick="Button70_Click" />
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
EmergencyMonthPointsTextBox1.Text = "1";
EmergencyTotalPointsTextBox1.Text = "4";
}
}
protected void Button71_Click(object sender, EventArgs e)
{
if (Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) > 0)
{
EmergencyMonthPointsTextBox1.Text = (Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) - 1).ToString();
EmergencyTotalPointsTextBox1.Text = (Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) + 1).ToString();
}
}
protected void Button70_Click(object sender, EventArgs e)
{
if (Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) > 0)
{
EmergencyMonthPointsTextBox1.Text = (Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) + 1).ToString();
EmergencyTotalPointsTextBox1.Text = (Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) - 1).ToString();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
EmergencyMonthPointsTextBox1.Text = "1"
EmergencyTotalPointsTextBox1.Text = "4"
End If
End Sub
Protected Sub Button71_Click(ByVal sender As Object, ByVal e As EventArgs)
If Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) > 0 Then
EmergencyMonthPointsTextBox1.Text = (Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) - 1).ToString()
EmergencyTotalPointsTextBox1.Text = (Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) + 1).ToString()
End If
End Sub
Protected Sub Button70_Click(ByVal sender As Object, ByVal e As EventArgs)
If Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) > 0 Then
EmergencyMonthPointsTextBox1.Text = (Convert.ToInt16(EmergencyMonthPointsTextBox1.Text) + 1).ToString()
EmergencyTotalPointsTextBox1.Text = (Convert.ToInt16(EmergencyTotalPointsTextBox1.Text) - 1).ToString()
End If
End Sub
Screenshot