Edit Grid: Using DropDownList shows "Undefined" as the DataTextField

3 posts, 1 answers
  1. Aron
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 01 May 2013 Link to this post

    I have had great success with your GRID widget but I am having one problem.  I am unable to get the dropDownMenu to show the possible choices, “undefined” shows up for every choice.  I looked through many threads on this topic but could not find a solution for me.

    I have a workable project where you can see this problem.  
    I modeled this page after your demo:  http://demos.kendoui.com/web/grid/editing-custom.html
    1. Login to site "http://life-renewal-test.org"  using ID=friend@gmail.com
    2. Psw = friend!
    3. Click "edit" near my Volunteer Offers to get to page manageVolunteerInfo.cshtml
    4. Click on Type “Fund Raising” to get the dropdownMenu choices
    5. All choices read “undefined”
    The page data is sourced from:  http://life-renewal-test.org/friend/volunteerGridRead.cshtml
    The dropdown data is sourced from: http://life-renewal-test.org/friend/volunteerTypeRead.cshtml

    Thank you
  2. Alex Gyoshev
    Alex Gyoshev avatar
    2515 posts

    Posted 03 May 2013 Link to this post

    Hello Aron,

    The request for the DropDownList data yields text data, and the dataSource processes each character of the string as an item, therefore getting the "undefined" text/value. You can either set the correct response header on the server (so that the client-side knows that a JSON response is returned), or hint the $.ajax method through the dataType configuration option:

      dataSource: {
         type: "json", // this is an invalid datasource type and is ignored
         transport: {
             read: {
                 url: "volunteerTypeRead.cshtml",
                 dataType: "json"

    Alex Gyoshev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Answer
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 19 May 2013 Link to this post

    Thanks for the tip.  That worked.
    Basically, I added a Response.ContentType command at the server cshtml.
            Response.ContentType = "application/json";
Back to Top