Hi,
I have a template that I want to display certain controls if I am editing and others if I am creating new.
I have the code shown below but it does not work. It seems that the template is initialized at the time the parent is loaded.
How can I display the dropdown list in create mode and the textbox in edit mode?
The code below doesn't work but shows what I am trying to do.
Thanks … Ed
<
div
class
=
"form-group"
>
<
label
class
=
"LabelStyle"
>Vial</
label
>
@{
if (Model != null && Model.IsCreatingNew)
{
@(Html.Kendo().DropDownListFor(m => m.VialId)
.AutoBind(true).DataValueField("VialId").DataTextField("VialName")
.DataSource(source =>
{
source.Ajax()
.Read(r => { r.Url("?handler=VialsRead").Data("forgeryToken"); });
}).HtmlAttributes(new { style = "width:150px" }))
<
span
asp-validation-for
=
"VialId"
class
=
"text-danger"
></
span
>
}
else
@(Html.TextBoxFor(m => m.VialName, new { @class = "border-0", @readonly = "true", @style = "width:50px; margin-top:-8px" }))
}
</
div
>