I have only been playing with MVC for the past month. I really like the Telerik controls for MVC, but I am having trouble getting the "Configuring Grid Ajax Data Binding" example from the video of that name to work correctly. I have a working Server Side example, but when I modify it as suggested in the video, I get a 500 Server Internal Error.
My index.aspx file is:
<%
@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Home Page
</
asp:Content>
<
asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Grid for ASP.NET MVC</h2>
<b>Data Binding Basics - Server Binding </b>
<% Html.Telerik().Grid<TelerikAjax.Models.lobreg>("lobregs")
.Name(
"grid1")
.DataBinding(d => d.Ajax().Select(
"AjaxGrid", "Home"))
.Columns(c => {
c.Bound(o => o.lobnum).ReadOnly();
c.Bound(o => o.year).ReadOnly();
c.Bound(o => o.lastname).ReadOnly();
c.Bound(o => o.firstname).ReadOnly();
c.Bound(o => o.initial).ReadOnly();
c.Bound(o => o.phone).ReadOnly();
c.Bound(o => o.email).ReadOnly();
})
.PrefixUrlParameters(
false)
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.Render();
%>
</
asp:Content>
My controller is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelerikAjax.Models;
using Telerik.Web.Mvc;
namespace TelerikAjax.Controllers
{
[
HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
ViewData[
"lobregs"] = new MVCLobbyingDataContext().lobregs.ToList();
return View();
}
public ActionResult About()
{
return View();
}
[
GridAction]
public ActionResult AjaxGrid()
{
return View(new GridModel(new MVCLobbyingDataContext().lobregs));
}
}
}
I think I have followed the example correctly, but perhaps I missed something...
I noticed that the example is for MVC 1, and I am using MVC 2. Is there something I need to change to make the example work with MVC 2?