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

clear radgrid item Editmode on check change.

4 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yogi
Top achievements
Rank 1
Yogi asked on 18 Oct 2008, 07:26 AM
Hi,

    I am facing a problem when i am working with radgrid checkbox column. When i checked the check box in comes into editmode, but when unchecked the column it not comes out from edit mode and checkbox remains in checked form.

plzz help me out.....

tks in advance.....

here is the code which i used...
protected void grdSearchResult_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            CheckBox chkbox = (e.Item as GridDataItem)["clmSelect"].Controls[0] as CheckBox;
            GridDataItem item = e.Item as GridDataItem;
            chkbox.Attributes.Add("onclick", "RowDblClick(" + item.ItemIndex + "," + chkbox.ClientID + ")");
            chkbox.Enabled = true;

        }
}
  protected void grdSearchResult_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
            return;

      if (!IsPostBack)
            return;

        foreach (GridItem item in grdSearchResult.MasterTableView.Items)
        {
            CheckBox chkbox = (item as            GridEditableItem)["clmSelect"].Controls[0] as CheckBox;
          if ((item is GridEditableItem) && (item.IsInEditMode))
            {               
                chkbox.Checked = true;
            }
        }
    }

On Client Side :
function onCheckClick(itemIndex, checkbox) {

                if (checkbox.checked == true) {
                   $find("<%= grdSearchResult.ClientID %>").get_masterTableView().editItem(itemIndex);
                }
                else {
                    $find("<%= grdSearchResult.ClientID %>").get_masterTableView().updateItem(itemIndex);
                  
                }
            }

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 20 Oct 2008, 06:56 AM
Hi Yogi,

Generally updateItem() will work only with automatic updates when the grid is bound via DataSourceID.

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Yogi
Top achievements
Rank 1
answered on 20 Oct 2008, 08:47 AM
Hi,

Thanks, but my question is how to remove item editmode when checkbox is unchecked?
0
Vlad
Telerik team
answered on 20 Oct 2008, 09:02 AM
Hello Yogi,

You can use cancelUpdate() client-side method.

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Yogi
Top achievements
Rank 1
answered on 20 Oct 2008, 12:00 PM
Thanks, it's work for me...
Tags
Grid
Asked by
Yogi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Yogi
Top achievements
Rank 1
Share this question
or