469,342 Members | 5,602 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,342 developers. It's quick & easy.

how to retreive checkbox value from the database in aspnet using c#

35
hello,

Actually I want to retreive the checkbox value from the database.

I have written like this:-

Chkbillingcode =ds.Tables[0].Rows[i]["billingcode"].ToString() ;
But it gives error.Could u help me to solve this problem.
Jan 8 '07 #1
5 8813
hello,

Actually I want to retreive the checkbox value from the database.

I have written like this:-

Chkbillingcode =ds.Tables[0].Rows[i]["billingcode"].ToString() ;
But it gives error.Could u help me to solve this problem.
hi..
r u trying to check d checkbox ctrl based on d database result?
is "Chkbillingcode" a checkbox ctrl?
then u can have it like Chkbillingcode.Checked=true or false...
hope this helps..
thanx,
sand...
Jan 8 '07 #2
muskan
35
thanks for reply

I have tried like that

Chkwithdrawn.Checked =ds.Tables[0].Rows[i][15].ToString();
but it still not working .It gives the error" cannot implicitly convert object to bool"

tell how to remove this error.

hi..
r u trying to check d checkbox ctrl based on d database result?
is "Chkbillingcode" a checkbox ctrl?
then u can have it like Chkbillingcode.Checked=true or false...
hope this helps..
thanx,
sand...
Jan 8 '07 #3
Muskan,

Try Out:
CheckBox1.Checked=Convert.ToBoolean(ds.Tables[0].Rows[0]["IsVisible"].ToString());

thanks for reply

I have tried like that

Chkwithdrawn.Checked =ds.Tables[0].Rows[i][15].ToString();
but it still not working .It gives the error" cannot implicitly convert object to bool"

tell how to remove this error.
Jan 8 '07 #4
thanks for reply

I have tried like that

Chkwithdrawn.Checked =ds.Tables[0].Rows[i][15].ToString();
but it still not working .It gives the error" cannot implicitly convert object to bool"

tell how to remove this error.
Hi...
u r gettin error b'coz Checked property of d checkbox has to b assigned a boolean value...true or false only...
so u will have 2 convert d data retrieved frm database into bool type...
OR
if it can't b converted, use a boolean flag variable to hold true or false based on
the data retrieved frm d database...for that, first retrieve d data value frm database and check it's value inorder to assign value to d boolean flag....
hope this helps,
thanx and rgrds
sand...
Jan 8 '07 #5
muskan
35
thanks for reply
now it is working

Muskan,

Try Out:
CheckBox1.Checked=Convert.ToBoolean(ds.Tables[0].Rows[0]["IsVisible"].ToString());
Jan 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Tomas Vera | last post: by
2 posts views Thread by Edmilson | last post: by
2 posts views Thread by /.. | last post: by
1 post views Thread by iforsyth | last post: by
4 posts views Thread by | last post: by
6 posts views Thread by Daz | last post: by
5 posts views Thread by =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.