Rebinding the unchecked Row

1 posts, 0 answers
  1. Ami
    Ami avatar
    1 posts
    Member since:
    Jan 2013

    Posted 02 Jan 2013 Link to this post

    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
                    }
    }
Back to Top