I created a custom popup editor for my grid. I have two string fields, both defined with [StringLength(20)] in the model. In the custom popup editor template I use EditorFor to display an editor for both fields. One gets a standard text input as expected. One gets the WYSIWYG editor. (Screenshot attached) Color me confused. Any ideas?
The two fields I'm referring to in the template below are PowerNumber and CaseNumber.
The model definitions are:
[Required]
[StringLength(20)]
[Display(Name="Power")]
public string PowerNumber { get; set; }
[StringLength(20)]
[Display(Name="Case #")]
public string CaseNumber {get; set;}
The editor template:
@model KendoMVC4.Models.Power
@Html.HiddenFor(model => model.ID)
<div class="editor-label">
@Html.LabelFor(model => model.PowerNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PowerNumber)
@Html.ValidationMessageFor(model => model.PowerNumber)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Posted)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Posted)
@Html.ValidationMessageFor(model => model.Posted)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Forfeited)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Forfeited)
@Html.ValidationMessageFor(model => model.Forfeited)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Discharged)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Discharged)
@Html.ValidationMessageFor(model => model.Discharged)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.CaseNumber)
</div>
<div class="editor-field">
@Html.Kendo().EditorFor(model => model.CaseNumber)
@Html.ValidationMessageFor(model => model.CaseNumber)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.State)
</div>
<div class="editor-field">
@(Html.Kendo().DropDownListFor(model => model.State)
.Name("State")
.OptionLabel("Select State")
.DataTextField("Text")
.DataValueField("Value")
.Items(items =>
{
items.Add().Text("Alaska").Value("AK");
items.Add().Text("Hawaii").Value("HI");
items.Add().Text("New York").Value("NY");
items.Add().Text("Texas").Value("TX");
})
)
</div>
<br />
The two fields I'm referring to in the template below are PowerNumber and CaseNumber.
The model definitions are:
[Required]
[StringLength(20)]
[Display(Name="Power")]
public string PowerNumber { get; set; }
[StringLength(20)]
[Display(Name="Case #")]
public string CaseNumber {get; set;}
The editor template:
@model KendoMVC4.Models.Power
@Html.HiddenFor(model => model.ID)
<div class="editor-label">
@Html.LabelFor(model => model.PowerNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PowerNumber)
@Html.ValidationMessageFor(model => model.PowerNumber)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Posted)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Posted)
@Html.ValidationMessageFor(model => model.Posted)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Forfeited)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Forfeited)
@Html.ValidationMessageFor(model => model.Forfeited)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.Discharged)
</div>
<div class="editor-field">
@Html.Kendo().DatePickerFor(model => model.Discharged)
@Html.ValidationMessageFor(model => model.Discharged)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.CaseNumber)
</div>
<div class="editor-field">
@Html.Kendo().EditorFor(model => model.CaseNumber)
@Html.ValidationMessageFor(model => model.CaseNumber)
</div>
<br />
<div class="editor-label">
@Html.LabelFor(model => model.State)
</div>
<div class="editor-field">
@(Html.Kendo().DropDownListFor(model => model.State)
.Name("State")
.OptionLabel("Select State")
.DataTextField("Text")
.DataValueField("Value")
.Items(items =>
{
items.Add().Text("Alaska").Value("AK");
items.Add().Text("Hawaii").Value("HI");
items.Add().Text("New York").Value("NY");
items.Add().Text("Texas").Value("TX");
})
)
</div>
<br />