I am pretty new to MVC/Telerik and am having an issue populating a grid. I created the standard Telerik MVC5 project with the Grid and menu. I added my model, created a context and updated the controllers and views. When i run the app on the Visual Studio IIS Express instance i have zero issues. However, once i publish it to an IIS 8 test server i receive HTTP 500 errors and an empty grid.Looking at the Fiddler results it appears that the read function on grid is the issue.
Grid Controller
public partial class GridController : Controller
{
public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
{
using (var ctx = new CWDataContext())
{
IQueryable<CWDataModel> carts = ctx.CW_Data;
DataSourceResult result = carts.ToDataSourceResult(request);
return Json(result);
}
}
}
Home Controller
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
}
Model
[Table("CWCartLblFile")]
public class CWDataModel
{
[Key]
public int Row_ID { get; set; }
public string COLOR { get; set; }
public string SKU { get; set;
}
Context
public class CWDataContext : DbContext
{
public CWDataContext() : base("defaultString")
{
}
public DbSet<CWDataModel> CW_Data {get; set;}
}
Index View
<div class="row">
<div class="col-12">
@(Html.Kendo().Grid<TelerikMvcApp1.Models.CWDataModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(product => product.COLOR).Width(50);
columns.Bound(product => product.SKU).Width(50);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
</div>
</div>
I am not sure if something in the code is incorrect or i overlooked something on the web server.