0

If i have 3 asp.net checkboxes in my asp.net webform namely : CheckBox1, Checkbox2, Checkbox3 and a textbox namely textbox1

If Checkbox1.text ="1"
Checkbox2.text ="2"
Checkbox3.text ="3"

I WANT :

if checkbox1 is already checked ... if checkbox is remain checked and even after i check checkbox2 and checkbox3 then the output in textbox would be 2,3 ..... by ignoring already checked checkbox text ...

LOGIC I WANT : Ignore already check checkboxes and insert recent checkbox text to textbox1 as comma seperated string ...

How to do that ?

1
  • It is not entirely clear what you want. Can you post examples of what output you want for different check states? Commented Jan 1, 2011 at 15:39

2 Answers 2

1

Checkboxes should not uncheck themselves when they are checked. Radiobuttons are what do that.

I am not sure if that answered your question, but I could not understand it completely. Please post part of your code so we can see what you mean.

Sign up to request clarification or add additional context in comments.

3 Comments

The simple logic is that .... if checkbox1 or checkbox2 or checkbox3 whatever the checkboxes is already checked on page load say if checkbox2 is checked already on page load /./// then when i check checkbox1 and then checkbox3 then in textbox1 the out put would be ..1,3 which igore the already checked checkbox (checkbox2)
Then you would have to write a function to detect all checkboxes that are checked on load and then ignore them again when u check the 2nd time. I would create an array of booleans. Element 0 would be checkbox1, Element 1 would be checkbox2, etc. Make them false if you do not want to check them the 2nd time.
Can anybody develop that for me ? in vb.net ? I would be very thankful to you ?
0
//Onpageload
bool[] ignorecheckboxes = new bool[2]; //2 should be the number of textboxes

if (checkbox1.Checked = true)
{
ignorecheckboxes[0] = false;
}
if (checkbox2.Checked = true)
{
ignorecheckboxes[1] = false;
}

//When you check again
bool[] checkboxes = new bool[2]; 

if (checkbox1.Checked = true)
{
checkboxes[0] = true;
}
if (checkbox2.Checked = true)
{
checkboxes[1] = true;
}

if (ignorecheckboxes[0] == false)
{
checkboxes[0] = false;
}
if (ignorecheckboxes[1] == false)
{
checkboxes[1] = false;
}
//Everything still true in the checkboxes array is what you want.

I would have added another comment, but the code was too long.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.