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

Datasource sync after create

1 Answer 120 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Dirk asked on 23 Aug 2012, 09:42 AM

I have a simple razor page using the Listview

          .DataSource(dataSource => dataSource
                                        .Model(model => model.Id("TicketEntryId"))                                        
                                        .Create(create => create.Action("TicketDetail_Create", "Ticket").Data("TicketInfo"))
                                        .Read(read => read.Action("TicketDetail_Read", "Ticket").Data("TicketInfo"))
                                        .Update(update => update.Action("TicketDetail_Update", "Ticket"))
                                        .Destroy(destroy => destroy.Action("TicketDetail_Destroy", "Ticket"))                                        

The Create method works but the object is partially populated at the server side and I need to visualize this data when the object is added to the list. So I need to either trigger a refresh of the current page or of the added object or something simular after the create.

I've searched the forum but can't find an answer to this problem which is strange as I guess everyone needs this kind of behavior.

best regards

1 Answer, 1 is accepted

Sort by
Petur Subev
Telerik team
answered on 28 Aug 2012, 08:53 AM
Hi Dirk,

Basically if you return the newly created item as shown in our offline demos you should get the values updated back on the client.
Here is how the Create action method looks like:
       public ActionResult Editing_Create([DataSourceRequest] DataSourceRequest request, ProductViewModel product)
           var results = new List<ProductViewModel>();
           if (product != null && ModelState.IsValid)
           return Json(results.ToDataSourceResult(request, ModelState));

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question