Custom Editor throwing js error after "Add New Record" clicked.

3 posts, 0 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    May 2016

    Posted 04 Aug 2016 Link to this post

    "Unhandled exception at line 1362, column 66 in Function code

    0x800a1391 - JavaScript runtime error: 'ParameterSet' is undefined."

    I'm going to include as little code as possible to demonstrate what things look like:

    >>View <<

     columns.Bound(c => c.ParameterSet).ClientTemplate("#=ParameterSet.Name#");

    >>View Model <<

    public class ModelingJobViewModel
       public JobParameterSetViewModel ParameterSet {get; set;}

    >> "Property" view model <<

    public class JobParameterSetViewModel
       public int Id {get; set;}
       public string Name {get; set;}

    >> Controller <<

      public ActionResult Index()
       ViewData["parameterSets"] = repo.SelectAll().Select(e=>new DropdownListItem() { Name =, Id = e.Id}).OrderBy(e => e.Name);

    >> Custom Editor (ParameterSetEditor) <<
    @model Web.Models.ModelingJobViewModel

    @(Html.Kendo().DropDownListFor(m => m)

    The initial view and the edit action buttons work fine.  But when "Add" is clicked, I get the error listed above.

    It's probably something stupid, but I've spun my wheels long enough and need to throw this out into the forum to see if anyone has an answer. Help!

    Thanks in advance!


  2. Dimiter Topalov
    Dimiter Topalov avatar
    633 posts

    Posted 08 Aug 2016 Link to this post

    Hello Dave,

    You can check out the following Grid online demo showing editing a field with a DropDownList custom editor, and apply the necessary adjustments to your implementation:

    The demo, along with its corresponding custom editor configuration, controller, and actions, is also available in the sample application, coming with your installation package:

    Please make sure to provide a default value for the ParameterSet field (equivalent to the Category field from the example).

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Dave
    Dave avatar
    2 posts
    Member since:
    May 2016

    Posted 08 Aug 2016 in reply to Dimiter Topalov Link to this post

    The lack of a default value for the field was the issue.  Added it, plus made sure the view model that was loaded in the list of possible values and the default matched the model used by the editor. Boom. Works.

    And...yeah...that was kinda stupid.  I should have made the connection with the Add New event and the lack of a default.

    Thanks for the assist!

Back to Top