I want to show or hide a div in my CustomEditorTemplate based on a value in my model, but I can't figure out how to accomplish this. In my case, an event requires approval, so I want to show a button if the model's Approved property is false.
3 Answers, 1 is accepted
0
Alexander Popov
Telerik team
answered on 15 Aug 2014, 08:18 AM
Hi Matthew,
This could be done by adding a visible binding, for example:
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.
I can't seem to get this to work. I'm using the following to call actions on my controller:
.Events(e => e.Error("error_handler"))
.Read("Read", "Scheduler")
.Update("Update", "Scheduler")
.Destroy("Destroy", "Scheduler")
.Create("Create", "Scheduler");
How do I access my model sent via my controller in order to use the visible binding?
0
Alexander Popov
Telerik team
answered on 19 Aug 2014, 12:13 PM
Hello again Matthew,
I am not sure I understand your questions correctly. Basically, when a custom editor template is specified it uses the same model as the Scheduler. The ASP.NET MVC wrappers use the Razor template to generate an equivalent Kendo UI Template, which is used by the Scheduler on the client side. Here is an example that mimics the behavior you wish to achieve:
@(Html.Kendo().Scheduler<MyViewModel>()
.Name("scheduler")
.Editable(e=>e.TemplateName("testTemplate"))
...
)
And Views\Shared\EditorTemplates\testTemplate.cshtml:
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.