Tech Talk A software developer on all things tech, and then some

23Mar/110

Fixing A Blue Filled Checkbox in .Net

If you ever seen the above check mark, you are probably wondering what the heck is going on. First off it's not checked or checked, some in between state where it's just filled with a blue square. Second off you even, most likely, have a variable bound to it, and yet it still displays as this!

The issue is that the variable that you have it bound to is null. This is the default way to show null in a check box, not just an empty square like you would expect such as when the value is equal to false. There is a solution you can try. If you are binding to a database and using SQL, you can use the following code to set all the values to null, then add a default of zero to the column to prevent the blue box from showing up.


UPDATE tableName
SET columnName= 0
WHERE columnName= null

ALTER TABLE tableName
ADD DEFAULT 0 FOR columnName;

If you are not using SQL, then check in visual studio for what ever data object you are binding to, and set it's default value to zero. (I'm not going to give a tutorial on each way since there are a few).

Hope this helps, and happy coding!

Comments (0) Trackbacks (0)

No comments yet.


Leave a Reply

No trackbacks yet.

%d bloggers like this: