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

Grid Delete row

4 Answers 264 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 30 Jun 2015, 10:34 PM
Hi, I currently have a kendo grid bound to a tempdata item which is a list of objects, on delete i remove the item that is being deleted from the tempdata item list , how can i refresh the grid ?  I tried returning the partial view that the grid is in but the partial view renders in the entire page even though i have it in an ajax.beginform, basically how can I make the partial view that contains the grid referesh in the delete action of the grid?

4 Answers, 1 is accepted

Sort by
0
Graeme
Top achievements
Rank 1
answered on 01 Jul 2015, 09:56 AM

Add an event to the Grid.DataSource.Ajax.Events

    RequestEnd("Grid_PostAction")

add a function to your javascript

   function PickListEditableGrid_PostAction(e) {
       if (e.type != "read") {
           $("#Grid").data("kendoGrid").dataSource.read();
       }
   }

0
Jim
Top achievements
Rank 1
answered on 02 Jul 2015, 03:30 PM

The problem is that if i set my action for destory only remove the tempdata item and not do anything else the page refreshes as blank:

 

 public void DeleteUser([Kendo.Mvc.UI.DataSourceRequest] Kendo.Mvc.UI.DataSourceRequest request,
             UserDTO user)
         {
             (new Models.ProjectModel()).DeleteUser(user.UserID);
             SetAccountUsers();
         }

0
Jim
Top achievements
Rank 1
answered on 02 Jul 2015, 03:33 PM
SetAccountUsers() is where i refetch the user list and assign it to the tempdata item
0
Jim
Top achievements
Rank 1
answered on 02 Jul 2015, 03:42 PM

never mind i had the unobtrusive script at the bottom of the page after the partial view rendering code, i just needed to put it at the top of the page and everything works fine.

 

thanks

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