Template for treelist popup editing

4 posts, 0 answers
  1. Alan F
    Alan F avatar
    4 posts
    Member since:
    Jan 2010

    Posted 28 Jan 2019 Link to this post

    Is there a way to use a template for popup editing in a treeview ?

    By default, the popup displays all the model's fields but i want to hide some.

    I can't figure out how to do that.

    Thanks for your help.

     

    Alan.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 29 Jan 2019 Link to this post

    Hello Alan,

    You could add partial view in the "Views\Shared\EditorTemplates" folder with the same name as the model bound to the TreeList. For example, adding a partial view with the name "EmployeeDirectoryModel.cshtml" in the folder will display its content when the TreeList is configured to be bound to that model:
    @(Html.Kendo().TreeList<Kendo.Mvc.Examples.Models.TreeList.EmployeeDirectoryModel>()

    You can also configure the TemplateName property to specify different partial view from the EditorTemplates folder:
    .Editable(e => e.Mode("popup").TemplateName("myCustomPopUpTemplate"))

    Hope this helps.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Alan F
    Alan F avatar
    4 posts
    Member since:
    Jan 2010

    Posted 30 Jan 2019 in reply to Konstantin Dikov Link to this post

    Thank you Konstantin. I took the second solution. It's a good start but not working yet. The partial view displays, but the "save" button triggers a 500 error. Data are not binded and the create action receives an empty entity. I there a special way to bind to the model in the partial view ? I used classic @Html.EditorFor(m=>...)

    Alan.

  4. Alan F
    Alan F avatar
    4 posts
    Member since:
    Jan 2010

    Posted 30 Jan 2019 in reply to Alan F Link to this post

    Sorry, my bad. It works great. Thanks a lot Konstantin.
Back to Top