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

DropDownList DataSource extension not generates datasource script

2 Answers 83 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Szymon
Top achievements
Rank 1
Szymon asked on 07 Nov 2012, 12:30 PM
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 Answers, 1 is accepted

Sort by
0
Atanu
Top achievements
Rank 1
answered on 20 Nov 2012, 05:34 AM
How you are populating the dropdownlist.
You haven't specified what is written inside the _Disconnections controller action.

Please share some more code.
0
Szymon
Top achievements
Rank 1
answered on 20 Nov 2012, 07:18 AM
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...
 
Tags
DropDownList
Asked by
Szymon
Top achievements
Rank 1
Answers by
Atanu
Top achievements
Rank 1
Szymon
Top achievements
Rank 1
Share this question
or