Sei sulla pagina 1di 3

6/17/2020 Refresh Parent Grid After sub-grid save in UI for ASP.

NET MVC Grid - Telerik Forums

Telerik Forums / UI for ASP.NET MVC Forum / Grid /

Refresh Parent Grid After sub-grid save Telerik UI for ASP.NET MVC
Resources Buy Try

Post a reply

ù Feed for this thread

3 posts, 1 answers

AP

242 posts
Member since:
Apr 2010
Posted 24 Sep 2015 Link to this post

I have a hierarchical grid, containing a list of records, with their associated actions.

When an action is inserted, the data repository will adjust the status of the master record, according to the action type that has been
inserted. This works, however I'm having difficulty refreshing the master grid to reflect the change in status.

I have put a handler on the action grids (the sub grid) save event, however this fires before the database change has been saved, so
the change to the master grids data isn't reflected?

What event can I handle to refresh the master grid once the data has been saved?

The code is:-

@(Html.Kendo().Grid<SimpleChangeControl.Models.View_Action>()
.Name("ActionsGrid_#=ID#")
.Events(e => e.Edit("onSubEdit"))
.Columns(columns =>
{
columns.Bound(o => o.ID).Title("ID");
columns.Bound(o => o.ActionType).Title("Type").ClientTemplate("<span>\\#=ActionTypeDescription\\#
</span>").Filterable(f => f.UI("actionTypeFilter"));
columns.Bound(o => o.Description).Title("Description");
columns.Command(command => { command.Edit(); command.Destroy(); });

})
.Filterable(f => f
.Extra(false)
.Operators(o => o
.ForNumber(str => str.Clear()
.IsEqualTo("Equals"))))
.ToolBar(commands => commands.Create())
.Editable(editable => editable
.Mode(GridEditMode.PopUp))
.DataSource(dataSource => dataSource
We use cookies to personalize.Ajax()
content and ads, to provide social media
.Events(e
features and to analyze our traffic. Some=> of e.Error(@<text>
these cookies alsofunction(e){subError(e,"ActionsGrid_#=ID#")}
help improve </text>))
.Model(m
your user experience on our websites, => m.Id(p
assist => p.ID)) and your ability to
with navigation ACCEPT COOKIES
.PageSize(10)
provide feedback, and assist with our promotional and marketing efforts. COOKIES SETTINGS
Please read our Cookie Policy for a more detailed description and click on the
.Read(read
settings button to customize how => read.Action("RD_Actions",
the site uses cookies for you. "ChangeRequests", new { ChangeRequestID = "#= ID #" }))

https://www.telerik.com/forums/refresh-parent-grid-after-sub-grid-save 1/3
6/17/2020 Refresh Parent Grid After sub-grid save in UI for ASP.NET MVC Grid - Telerik Forums
.Create(create => create.Action("InsertAction", "ChangeRequests", new { CRID = "#= ID #" }))
.Update(update => update.Action("UpdateAction", "ChangeRequests"))
.Destroy(delete => delete.Action("DeleteAction", "ChangeRequests"))

)
.Filterable()
.Events(e=>e.Save("actionSave"))
.Pageable(p => p.Refresh(true))

.ToClientTemplate())

The handler is:-

function actionSave()
{
var grid = $('#Grid').data("kendoGrid");

grid.dataSource.read();
}

Reply

ANSWER

Kiril Nikolov
ADMIN

2596 posts
Posted 28 Sep 2015 Link to this post

Hello AP,

I would suggest you to use the dataSource sync event that will be fired when the record is updated, and there you can refresh the
parent grid. Please test it out and let me know if it helps.

Regards,
Kiril Nikolov
Telerik

å 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 Feedback Portal and vote to affect the priority of the items

Reply

AP

https://www.telerik.com/forums/refresh-parent-grid-after-sub-grid-save 2/3
6/17/2020 Refresh Parent Grid After sub-grid save in UI for ASP.NET MVC Grid - Telerik Forums

242 posts
Member since:
Apr 2010
Posted 28 Sep 2015 in reply to Kiril Nikolov Link to this post

That's worked. Thanks.


Reply

Post a reply Back to Top

Telerik and Kendo UI are part of Progress product portfolio.


Progress is the leading provider of application development and
digital experience technologies.

Company Technology Awards Press Releases Media Coverage Careers Offices

Copyright © 2020, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software
Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.

https://www.telerik.com/forums/refresh-parent-grid-after-sub-grid-save 3/3

Potrebbero piacerti anche