Datasource sync after create

2 posts, 0 answers
  1. Dirk
    Dirk avatar
    1 posts
    Member since:
    Aug 2012

    Posted 23 Aug 2012 Link to this post


    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
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 28 Aug 2012 Link to this post

    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!
Back to Top