Thursday, 14 June 2012

Select All Check BoxList
public void SelectAllCheckBoxes(object sender, EventArgs args)
        {
            try
            {
                CheckBox chk = (CheckBox)gridAsset.HeaderRow.FindControl("checkHeader");
                if (chk.Checked == true)
                {
                    for (int i = 0; i < gridAsset.Rows.Count; i++)
                    {
                        CheckBox chkOther = (CheckBox)gridAsset.Rows[i].Cells[0].FindControl("check");
                        chkOther.Checked = true;
                    }
                }
                else
                {
                    for (int i = 0; i < gridAsset.Rows.Count; i++)
                    {
                        //TextBox txtDocName = (TextBox)grdTenantVari.Rows[i].Cells[0].FindControl("txtDocHead");
                        CheckBox chkOther = (CheckBox)gridAsset.Rows[i].Cells[0].FindControl("check");
                        chkOther.Checked = false;
                    }
                }
            }
            catch (Exception _exc)
            {
                throw _exc;
            }
           

        }

No comments:

Post a Comment