Rahul Kumar
Rahul Kumar

Reputation: 699

Want a checkbox to be selected according to its database value only in C#

I have 12 check boxes and i want to be checked or unchecked these check boxes according to there database values. I want to perform this action in c# not in ASP .NET.

Upvotes: 0

Views: 55

Answers (1)

abdul
abdul

Reputation: 1582

You can convert 0 or 1 to boolean using Convert.ToBoolean() method:

checkBox1.Checked = Convert.ToBoolean(1); //true -- any number except for 0
checkBox1.Checked = Convert.ToBoolean(0); //false

Upvotes: 1

Related Questions