Home > DeveloperSection > Forums > How to found CheckBox ID
jayprakash sharma
jayprakash sharma

Total Post:117

Points:821
Posted on    January-26-2015 10:51 PM

 ASP.Net C# 
Ratings:


 1 Reply(s)
 611  View(s)
Rate this:

I want to check a checkbox after finding that it is checked in database. I'm trying this:

string chkboxbit = String.Empty;

CheckBox cb = new CheckBox();

chkboxbit = "ct100$ContentPlaceHolder1_chk" + item + "" + i;

cb = (CheckBox)Page.FindControl(chkboxbit.ToString());

cb.Checked = false;

But I'm getting cb value null on debugging.



Pravesh Singh
Pravesh Singh

Total Post:101

Points:709
Posted on    January-27-2015 12:18 AM

Hi jay


I got it... and it works fine...

chkboxbit = "chk" + item + "" + i;

ContentPlaceHolder cph = (ContentPlaceHolder)this.Master.FindControl("ContentPlaceHolder1");

cb = ((CheckBox)cph.FindControl(chkboxbit));

if (cb != null)

    cb.Checked = false;

Thnks to all for their effort. and Thanks Kyojimaru.


Modified On Apr-12-2016 12:14:44 AM

Don't want to miss updates? Please click the below button!

Follow MindStick