Thursday, 15 August 2013

Set checkbox value from database in C# asp.net -



Set checkbox value from database in C# asp.net -

i have 8 checkboxes. on page load event want write code such that if value in database "submitted" checkbox appear checked. if value "not submitted" appear unchecked.

you can have this

if(!page.ispostback) { var ischecked = dbvalue.tolower() == "submitted" ? true : false; (var = 0; < 8;i++ ) { checkbox chk = (checkbox)form.findcontrol("chk" + i); if(chk != null) chk.checked = ischecked; } }

c# asp.net

No comments:

Post a Comment