I created a custom editor for my Scheduler, which works well.
Then, I wanted to hide some parts of it with the help of a flag on my ViewModel like this:
<div class="k-edit-label">
@(Html.LabelFor(model => model.Title))
</div>
<div data-container-for="title" class="k-edit-field">
@(Html.TextBoxFor(model => model.Title, new { @class = "k-textbox", data_bind = "value:title" }))
</div>
if(@Model.XXX) {
<div class="k-edit-label">
@(Html.LabelFor(model => model.Description))
</div>
<div data-container-for="description" class="k-edit-field">
@(Html.TextAreaFor(model => model.Description, new { @class = "k-textbox", data_bind = "value:description", rows = 3 }))
</div>
}
But that didn't work. A debugging session shown that my XXX flag was always false. Curiously, if I'm writing something like this
<div data-container-for="xxx" class="k-edit-field">
@(Html.TextBoxFor(model => model.XXX, new { @class = "k-textbox", data_bind = "value:xxx" }))
</div>
I'm seeing the correct value (something true, something false).
So my question is: why using @Model.XXX always return false (the default value of a flag) and how then to implement the behavior I would like?
Thanks & Cheers,
Nicolas