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

Template for treelist popup editing

3 Answers 153 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alan F
Top achievements
Rank 1
Alan F asked on 28 Jan 2019, 09:53 AM

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.

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 29 Jan 2019, 02:02 PM
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.
0
Alan F
Top achievements
Rank 1
answered on 30 Jan 2019, 02:23 PM

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.

0
Alan F
Top achievements
Rank 1
answered on 30 Jan 2019, 03:07 PM
Sorry, my bad. It works great. Thanks a lot Konstantin.
Tags
General Discussions
Asked by
Alan F
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Alan F
Top achievements
Rank 1
Share this question
or