Check All checkbox in datagrid-row when a checkbox is checked within same row
<p>I am developing a webpage for changing Rights(Add/View/Delete/Edit/All) for a subadministrator for all modules in Project.Say, there are 5 modules. I have loaded current rights in datagrid for each module(in datagrid there are 5 rows(modules) and for that module 5 columns of rights in checkbox). I need functionality like, when i check 'ALL' checkbox, for that (module), other checkbox for Add,View,Edit,Delete should be checked and when i uncheck 'ALL' checkbox, other checkbox should be unchecked.
Any solution accepted for javascript or any event.
I tried with checkedchanged event, but it checkes/unchecks all the checkboxes of entire datagrid instead for that module(row). In checkedchanged event i wrote this code..</p>

<pre><code>foreach (DataGridItem dgitem in dg_rights.Items)
            {
                CheckBox chkall = (CheckBox)dgitem.FindControl("chk_all");
                CheckBox chkadd = (CheckBox)dgitem.FindControl("chk_add");
                CheckBox chkedit = (CheckBox)dgitem.FindControl("chk_edit");
                CheckBox chkview = (CheckBox)dgitem.FindControl("chk_view");
                CheckBox chkdelete = (CheckBox)dgitem.FindControl("chk_delete");
                if (chkall.Checked)
                {
                    chkadd.Checked = true;
                    chkedit.Checked = chkview.Checked = chkedit.Checked = chkdelete.Checked = true;
                }
                else
                {
                    chkadd.Checked = false;
                    chkedit.Checked = chkview.Checked = chkedit.Checked = chkdelete.Checked = false;
                }
            }
</code></pre>

<p>Looks like a am missing some basic thing or making a mistake.
Any idea.
Thanks
Anish</p>
