This is a migrated thread and some comments may be shown as answers.

Rebinding the unchecked Row

0 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ami
Top achievements
Rank 1
Ami asked on 02 Jan 2013, 08:11 AM
hi,

i am new in telerik world, i have rad grid, whose first column as a check box, and another as rad numeric text box, which is disabled by default and got enabled only when the check box is checked. And i have one check box in the header template of the first column to check all. my scenario is like this.
i checked the header checkbox and changed one text box value, after that i unchecked the checkbox of that row, i need to rebind that row only, meaning i have to get back the old value in the rad numeric text box, is it possible? pls help.
am pasting my code below
protected void SelectAll_CheckedChangedEvent(object sender, EventArgs e)
        {
           CheckBox SelectAll = sender as CheckBox;
           foreach (GridItem item in grdOnDSelection.Items)
           {
             if (SelectAll.Checked == true)
               {
                  CheckBox chk = (CheckBox)item.Cells[2].FindControl("chkOnDSelection");
                   chk.Checked = true;
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                        txtDsicountPercent.Enabled = true;
                    }
                    else
                    {
                        RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                        txtDsicountPercent.Enabled = false;
 
                        grdOnDSelection.Rebind();
                    }
                }
           
        }
 
protected void chkOnDSelection_checkedChangedEvent(object sender, EventArgs e)
 {
((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
                CheckBox chk = sender as CheckBox;
                GridItem item = chk.NamingContainer as GridItem;
                if (chk.Checked && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox)
                {
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                    txtDsicountPercent.Enabled = true;
                }
                if (chk.Checked == false && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox)
                {
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                    txtDsicountPercent.Enabled = false;
                    //grdOnDSelection.Rebind();//all chkboxes will be deselected
                }
}

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Ami
Top achievements
Rank 1
Share this question
or