Accessing Bound Model Values in Popup Template

2 posts, 0 answers
  1. John
    John avatar
    23 posts
    Member since:
    Nov 2012

    Posted 28 Apr 2014 Link to this post

    Hi,

    I have a grid of records that are editable (popup). 

    When I click edit and launch the popup editor template I have another grid that is populated by passing a value to a controller method. I'm trying to access this value from the ViewModel that the original selected record is built from.

    I understand the editor template serialization and there has been a similar question posted here: http://www.telerik.com/forums/model-not-initialized-in-grid-popup-editor-

    Does anyone know how to access the bound data from within a template?

    Regards
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 30 Apr 2014 Link to this post

    Hello John,

    Inside the popup template you can use all kind of bindings (such as html or value) to display/edit the fields that you need. On a side note you can use the edit event of the grid to get reference to the model (via e.model).

    If above is still not a case you can access it through the options of the Grid which is only possible if the Grid is in edit mode:

    var model = $("#grid").data("kendoGrid").editable.options.model;

    If you are looking for a C# way, as explained in the other thread it is not possible.

    Kind Regards,
    Petur Subev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top