Hi,
I'm migrating an MVC3 application to MVC5 which includes heavy use of the Kendo library. My new solution includes the bits from UI for MVC. I'm seeing an issue with defining the DBContext for a particular view. My code is as follows:
Since I'm now using Entity Framework and have a Model AFCountry, what must I do to ensure that the DropDownList pulls from this particular table? Is there a new/different approach that must be taken?
Thanks much for your help and guidance.
I'm migrating an MVC3 application to MVC5 which includes heavy use of the Kendo library. My new solution includes the bits from UI for MVC. I'm seeing an issue with defining the DBContext for a particular view. My code is as follows:
01.
var
ctx = System.Web.HttpContext.Current.GetDataContext;
02.
03.
$jqInt(
"#to-country"
).kendoDropDownList({
04.
dataValueField:
"id"
,
05.
dataTextField:
"name"
,
06.
dataSource:$jqInt.merge([{ id:
''
, name:
'Select Country'
}], @Html.Raw(Json.Encode(ctx.AFCountries.Select(x =>
new
{ x.id, x.name })))),
07.
change:
function
(e){
08.
quote.set(
"toCountry"
, e.sender.value());
09.
$jqInt(
"#to-city"
).data(
"kendoDropDownList"
).dataSource.read();
10.
}
11.
});
Since I'm now using Entity Framework and have a Model AFCountry, what must I do to ensure that the DropDownList pulls from this particular table? Is there a new/different approach that must be taken?
Thanks much for your help and guidance.