0
votes

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 ?

2
It is not entirely clear what you want. Can you post examples of what output you want for different check states?Oded

2 Answers

1
votes

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.

0
votes
//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.