Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with a CheckBox when it is false in C#

Status
Not open for further replies.

tondarb

Programmer
Oct 8, 2003
37
US
Hi I am having a doubt abt a CheckBox in a Repeater Control.
When a checkBox is false I am unable to set Attributes..

this is what my code in C#

if (rptId == 14)
{
CheckBox chk = (CheckBox)e.Item.FindControl("chkEP");
chk.Attributes.Add("rptId", reportId.ToString());
chk.Attributes.Add("grpId", grpId.ToString());

if (chk != null)
chk.Checked = false;
}

public void chkEP_OnCheckedChanged(Object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;

int rptId = int.Parse(cb.Attributes["rptId"]);
int grpId = int.Parse(cb.Attributes["grpId"]);
if (cb.Checked == true)
{
//dosomething
}
else
{
//dosomething
}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top