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

[Solved] Inline Edit wont refresh on delete

6 Answers 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 2
John asked on 11 Nov 2010, 12:53 AM
Hi

I have a small issue with inline grid editing.  Everything appears to work as expected except for the delete.  The delete deletes the row from the database and returns the gridview less the row deleted but the gris does not refresh corrcetly.

Here is the defintion of the grid.

<%: Html.Telerik() _
                .Grid(Of AIMSModels.UserIPItemModel)() _
                .Name("UserIPSummaryGrid") _
                .DataKeys(Function(keys) keys.Add(Function(o) o.UserIpID)) _
                .ToolBar(Function(commands) commands.Insert().ButtonType(GridButtonType.Text)) _
                .Columns(Sub(columns)
                             columns.Bound(Function(o) o.IPStart).Width(150).Title("Starting IP Range")
                             columns.Bound(Function(o) o.IPEnd).Width(150).Title("Ending IP Range")
                             columns.Bound(Function(o) o.ScreenSaverID).Width(150).Title("Extended ScreenSaver").ClientTemplate("<#= ScreenSaver #>")
                             columns.Command(Sub(commands)
                                                 commands.Edit().ButtonType(GridButtonType.Text)
                                                 commands.Delete().ButtonType(GridButtonType.Text)
                                             End Sub)
                         End Sub) _
                .DataBinding(Sub(dataBinding)
                                 dataBinding.Ajax() _
                                     .Select("_AjaxUserIPSummary", "User") _
                                     .Insert("_AjaxUserIPInsert", "User", New With {.UserID = Model.UserID}) _
                                     .Update("_AjaxUserIPUpdate", "User", New With {.UserID = Model.UserID}) _
                                     .Delete("_AjaxUserIPDelete", "User", New With {.UserID = Model.UserID})
                             End Sub) _
                .Resizable(Function(resizing) resizing.Columns(True)) _
                .Scrollable(Function(scrolling) scrolling.Height(250)) _
                .Scrollable(Function(scrolling) scrolling.Enabled(True)) _
                .Editable(Function(editing) editing.Mode(GridEditMode.InLine)) _
                .ClientEvents(Function(events) events.OnEdit("onEdit")) _
                .Footer(True)%>

and  here is the delete code.

Function _AjaxUserIPDelete(ByVal id As Integer, ByVal Model As UserIPItemModel) As ActionResult
    Model.UserIpID = id
    Model.Delete()
    Return View(New GridModel(UserIPViewModel.GetUserIPItems(Model.UserID)))
End Function

I have checked the result set returned after the delete doesn't include the deleted row.  The only way to corrcet the grid so far is to click the refresh button.

Hope this is clear.

John

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 11 Nov 2010, 07:35 AM
Hello John,

 Could you provide a sample project? Delete works as expected in our online demos and we are not sure what is different in your case.

Kind regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 16 Nov 2010, 07:58 PM
I have exactly the same problem!

I post it in http://www.telerik.com/community/forums/aspnet-mvc/grid/problem-with-grid-ajax-rebind.aspx
0
John
Top achievements
Rank 2
answered on 17 Nov 2010, 01:30 PM
I have the issue in 2 places, one of them is on a RADWindow the othere is in a MVC Tab, the refresh after delete for some reason doesn't work.  I chedked the Ajax call and it is being triggered and returns the corrcet rows.  As Atanas requested we provide a sample which i plan to do by next week.  I will let you know if i find anything out.  Very strange as the samples work.

John
0
montgomery
Top achievements
Rank 1
answered on 05 May 2011, 12:49 AM
Did anyone ever find an answer to this issue. I came across the same issue today. I verified the JSON is correct but the grid does not refresh on delete. Add and Update work fine.

[EDIT] Never mind. If anyone else comes across this behavior, follow the suggestion in the link referred to earlier. http://www.telerik.com/community/forums/aspnet-mvc/grid/problem-with-grid-ajax-rebind.aspx

Almost certainly your model is throwing errors on validation. The easiest solution is to simply not use your model in your controller but pass in the item key property instead ("Id"). I had no particular reason to use a model parameter and it was there simply from a copy and paste. Change "public virtual ActionResult _Ajax_Delete(MyModel mm)" to "public virtual ActionResult _Ajax_Delete(Guid Id)" and you should be all set.
0
John
Top achievements
Rank 2
answered on 05 May 2011, 01:14 PM
Hi

The issue for me has gone away and the code works as expected in both places.  The issue could have been solved by one of couple ofthings that has changed.
  1. I am using the latest MVC release
  2. I converted the project to C#, much better way to work att he end of the day as VB messed with the lambda expressions and also with VS2010 SP1 vb strted doing strange things
  3. Upgrade to VS2010 SP1

I hope that helps anyone.

John

0
Wahaj
Top achievements
Rank 1
answered on 21 Feb 2012, 07:58 AM
Tags
Grid
Asked by
John
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Daniel
Top achievements
Rank 1
John
Top achievements
Rank 2
montgomery
Top achievements
Rank 1
Wahaj
Top achievements
Rank 1
Share this question
or