开发者

how to ignore already checked checkboxes in vb.net / asp.net?

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 :

开发者_如何学JAVA

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 ?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜