Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net using mvc 3 applying kendo ui
    primarykey
    data
    text
    <p>sir can anyone lend me a hand in fixing my program.. im using kendo ui in my asp.net mvc. the problem is the records in the database is not being display everytime i run the program it just display nothing.and indicate a error.. saying "{"The entity or complex type 'database.APPLICANT' cannot be constructed in a LINQ to Entities query."}"</p> <p>here is my controller:</p> <pre><code> private IQueryable&lt;APPLICANT&gt; GetApplicant() { var applicants = (from a in dbContext.APPLICANTs select a).Take(50).ToList(); return applicants as IQueryable&lt;APPLICANT&gt;; } public ActionResult GetApplicant([DataSourceRequest] DataSourceRequest request) { return Json(GetApplicant().ToDataSourceResult(request)); } public ActionResult UpdateCustomer([DataSourceRequest] DataSourceRequest request, APPLICANT applicant) { var customerToUpdate = dbContext.APPLICANTs.First(app =&gt; app.APPLICANT_ID == applicant.APPLICANT_ID); TryUpdateModel(customerToUpdate); dbContext.SaveChanges(); return Json(ModelState.ToDataSourceResult()); } public ActionResult InsertCustomer([DataSourceRequest] DataSourceRequest request, APPLICANT customerToAdd) { if (ModelState.IsValid) { dbContext.APPLICANTs.Add(customerToAdd); dbContext.SaveChanges(); } return Json(new[] { customerToAdd }.ToDataSourceResult(request)); } public ActionResult DeleteCustomer([DataSourceRequest] DataSourceRequest request, APPLICANT applicant) { var customerToDelete = dbContext.APPLICANTs.First(app =&gt; app.APPLICANT_ID == applicant.APPLICANT_ID); if (customerToDelete != null) { dbContext.APPLICANTs.Remove(customerToDelete); dbContext.SaveChanges(); } return Json(new[] { customerToDelete }.ToDataSourceResult(request)); } </code></pre> <p>my context:</p> <pre><code> public partial class APPLICANT { public int APPLICANT_ID { get; set; } public string APPLICANT_LastName { get; set; } public string APPLICANT_FirstName { get; set; } public string APPLICANT_MiddleName { get; set; } public string APPLICANT_Address { get; set; } public string APPLICANT_City { get; set; } public string APPLICANT_ZipCode { get; set; } public string APPLICANT_Phone { get; set; } public string APPLICANT_Email { get; set; } } </code></pre> <p>index:</p> <pre><code>@{ ViewBag.Title = "Home Page"; } &lt;h2&gt;@ViewBag.Message&lt;/h2&gt; @(Html.Kendo().Grid&lt;KendoGridMvcCodeFirst.ViewModels.APPLICANT&gt;() .Name("APPLICANT") .ToolBar(tb =&gt; tb.Create()) .Pageable() .DataSource(dataSource =&gt; dataSource.Ajax() .Model(model =&gt; model.Id(c =&gt; c.APPLICANT_ID)) .Read("GetAPPLICANT", "Home") .Update("UpdateCustomer", "Home") .Create("InsertCustomer", "Home") .Destroy("DeleteCustomer", "Home")) .Columns(cols =&gt; { cols.Bound(c =&gt; c.APPLICANT_LastName).Width(200); cols.Bound(c =&gt; c.APPLICANT_FirstName).Width(200); cols.Bound(c =&gt; c.APPLICANT_MiddleName).Width(200); cols.Bound(c =&gt; c.APPLICANT_Address); cols.Bound(c =&gt; c.APPLICANT_City); cols.Bound(c =&gt; c.APPLICANT_ZipCode); cols.Bound(c =&gt; c.APPLICANT_Phone); cols.Bound(c =&gt; c.APPLICANT_Email); cols.Command(cmd =&gt; { cmd.Edit(); cmd.Destroy(); }); }) ) </code></pre> <p>*what is missing in my codes? thanks for those who can help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload