Hi, I have a problem I do not find resolve the matter simply, when the user chooses the item from the list add value to the textbox
When I want to cancel the selection subtract the value of the textbox,
When the selection was canceled I want to know the item that was nullified CheckBoxList.SelectedValue use but do not work
Code:if (CheckBoxList.SelectedIndex > -1) { Response.Write("Checked"); cnn.Open(); string cmdString = "select * from [merit] where [System_Name] = '" + DropDownList5.SelectedValue + "' and [Merit] = '" + CheckBoxList.SelectedValue + "'"; SqlCommand cmd = new SqlCommand(cmdString, cnn); SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { int A; int B; int Z; A = Convert.ToInt32(TextBox1.Text); B = dr1.GetInt32(3); Z = A + B; TextBox1.Text = Z.ToString(); } cnn.Close(); } else { cnn.Open(); string cmdString = "select * from [merit] where [System_Name] = '" + DropDownList5.SelectedValue + "' and [Merit] = '" + CheckBoxList.SelectedValue + "'"; SqlCommand cmd = new SqlCommand(cmdString, cnn); SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { int A; int B; int Z; A = Convert.ToInt32(TextBox1.Text); B = dr1.GetInt32(3); Z = A - B; TextBox1.Text = Z.ToString(); } cnn.Close(); }
thanks in advane
with my regards




Reply With Quote