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

How to cancel edit mode when filtering

2 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joey
Top achievements
Rank 1
Joey asked on 07 Jun 2013, 01:22 AM
Hi guys. I have implemented a RadGrid with Edit and Insert Mode and filter capabilities.

When filtering the RadGrid while in edit mode, the edited row seems to be based on the row number, eg, when I'm editing row number 3, and while editing, the grid is filtered, the edited row remains at row number 3 even though the row of the record I'm currently editing may have changed.

For Example, if I'm doing auto CRUD on this table with in place editing

[id] [code]
-----------------------
[01] codeX
[02] codeY
[03] codeY

and the row being edited is the 2nd one ([02] codeY)

if a filter (using the RadGrid default filter) is done on Code "EqualTo" 'codeY' such that the result becomes

[id] [code]
-----------------------
[02] codeY
[03] codeY

the edited row is still the 2nd one ([03] codeY) even though the row originally being edited is ([02] codeY)

Is this the expected behaviour, or is there are way to instruct the RadGrid to look for the record to set the edit mode on that particular record again? If not, is there a way to automatically cancel edit mode/insert mode just before filtering? Or to disable all filtering controls while user is in edit/insert mode? Thanks for reading.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Jun 2013, 04:00 AM
Hi Joey,

You can hide the filtering when in edit mode on ItemDataBound event.Try the below code.

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

Thanks,
Princy
0
Joey
Top achievements
Rank 1
answered on 07 Jun 2013, 04:19 AM
Thanks for the reply Princy. I think my question is misunderstood. I want the edit in place row to be correctly selected even when the row changes after filtering. I've reposted this in another thread because I cant change the topic. Please delete this thread and respond instead to (http://www.telerik.com/community/forums/aspnet-ajax/grid/telerik-radgrid---filtering-while-editing-does-not-remember-correct-row.aspx#2653404)
Tags
Grid
Asked by
Joey
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Joey
Top achievements
Rank 1
Share this question
or