DropDownList DataSource extension not generates datasource script

3 posts, 0 answers
  1. Szymon
    Szymon avatar
    4 posts
    Member since:
    Sep 2012

    Posted 07 Nov 2012 Link to this post

    In my project this code
    @(Html.Kendo().DropDownListFor(x => x.Event.DisconnectionId)
                                   .DataValueField("Id")
                                   .DataTextField("Name")
                                              .DataSource(source =>
                                              {
                                                  source.Read(read =>
                                                  {
                                                      read.Action("_Disconnections", "Event");
                                                  })
                                                  .ServerFiltering(true);
                                              })
                                 )


    generates following html

    <input id="Event_DisconnectionId" name="Event.DisconnectionId" type="text" value="0" /><script>
       jQuery(function(){jQuery("#Event_DisconnectionId").kendoDropDownList({dataTextField:"Name",dataValueField:"Id"});});

    Could not read  "disconnections" data because datasource property (dataSource:{transport:{read:{url:"/Event/_Disconnections" ... etc. ) is not generated. Why? Please help.

  2. Atanu
    Atanu avatar
    40 posts
    Member since:
    Jan 2012

    Posted 19 Nov 2012 Link to this post

    How you are populating the dropdownlist.
    You haven't specified what is written inside the _Disconnections controller action.

    Please share some more code.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Szymon
    Szymon avatar
    4 posts
    Member since:
    Sep 2012

    Posted 20 Nov 2012 Link to this post

    Solved. I had no default route in routing configuration file and for this action UrlHelper was returning null url. In result dataSource property was not generated. 

    In my opinion it is Kendo design error. It should throws exception when url is null. It took me a days...
     
Back to Top