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

Disable filtering if grid is in edit mode

2 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mircea
Top achievements
Rank 1
Mircea asked on 18 Jun 2019, 09:09 PM

Hello,

I have a grid that uses "EditForms" to edit a record. What I would like to achieve is to disable filtering while the grid is in edit mode (both for adding a new record or editing an existing one)

Thank you,

Marc

 

2 Answers, 1 is accepted

Sort by
0
Mircea
Top achievements
Rank 1
answered on 19 Jun 2019, 01:25 PM

UPDATE:

I found this code:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridEditableItem && e.Item.IsInEditMode)
 {
   RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0].Visible = false;
 }
}

 

It works, however... I would like it to work as well when I expand the detail table.

Please advise.

0
Mircea
Top achievements
Rank 1
answered on 19 Jun 2019, 01:46 PM

I found a solution that seems to work:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item.OwnerTableView.Name == "ChildID")
    {
        if (e.Item.Expanded)
            RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)(0).Visible = false;
    }
}

Tags
Grid
Asked by
Mircea
Top achievements
Rank 1
Answers by
Mircea
Top achievements
Rank 1
Share this question
or