Example #1
0
        private static void SetSelectedRow(GridViewRow r, CheckBox chk)
        {
            GridViewExt gv = (GridViewExt)r.NamingContainer;
            int         id = int.Parse(chk.Style["ObjID"]);

            if (chk.Checked)
            {
                if (!gv.SelectedRows.Contains(id))
                {
                    gv.SelectedRows.Add(id);
                }
            }
            else
            {
                gv.SelectedRows.Remove(id);
            }
            SetRowCss(r, chk.Checked);
        }
Example #2
0
            void chkall_CheckedChanged(object sender, EventArgs e)
            {
                CheckBox    chkall = (CheckBox)sender;
                GridViewExt gv     = (GridViewExt)chkall.NamingContainer.NamingContainer;

                foreach (GridViewRow r in gv.Rows)
                {
                    if (r.RowType == DataControlRowType.DataRow)
                    {
                        CheckBox chk = (CheckBox)r.FindControl("chk");
                        if (chk.Enabled)
                        {
                            chk.Checked = chkall.Checked;
                        }
                        SetSelectedRow(r, chk);
                    }
                }
            }