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

Custom Popup Editor Showing WYSIWYG editor for simple string field

2 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frederick
Top achievements
Rank 1
Frederick asked on 28 Jun 2013, 05:45 PM
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 />

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Jul 2013, 03:36 PM
Hello,

For PowerNumber you are using the MVC Html.EditorFor helper:

@Html.EditorFor(model => model.PowerNumber)
and for CaseNumber you are using the Kendo.EditorFor helper:
@Html.Kendo().EditorFor(model => model.CaseNumber)
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Frederick
Top achievements
Rank 1
answered on 02 Jul 2013, 03:38 PM
Well, that's what I get for coding at 2AM I guess.  Thanks for pointing out my rather glaring mistake.
Tags
Grid
Asked by
Frederick
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Frederick
Top achievements
Rank 1
Share this question
or