CheckBoxlist Select ALl
-
I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.
-
I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.
You are doing the string comparison which may result true in all cases. Use id(chk.selectedvalue != 0) instead of id(chk.selectedvalue != "0"). Or you can also try id(chk.Checked == false)
-
I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.
Change you All id to -1
Never underestimate the power of human stupidity RAH