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

ServerBinding versus AjaxBinding

0 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nate
Top achievements
Rank 1
Nate asked on 05 May 2011, 08:59 PM
This works with server binding but when I change to AjaxBinding I get this error. Anyone know why this does not work in AjaxBinding?

error.Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type

Code:

 

 

//Used for the Ajax binding

 

[

 

GridAction]

 

 

 

 

public ActionResult _AjaxBinding()

 

 

{

 

 

 

ProjectViewModel objProjectViewModel = new ProjectViewModel();

 

 

objProjectViewModel.ProjectList = Repository.GetProjects();

 

 

 

 

 

return View(new GridModel<MvcMyAPP.T_Project>(objProjectViewModel.ProjectList));

 

 

}

---GRID-----

 

 

@{Html.Telerik().Grid(Model)

 

.Name(

 

 

"Grid")

 

 

 

 

 

 

 

//.Editable(editing=> editing.Mode(GridEditMode.PopUp)

 

 

 

 

 

 

 

.ToolBar(t => t.Insert().ButtonType(

 

 

GridButtonType.Image))

 

 

.DataKeys( keys=>keys.Add(c=>c.ProjectId))

 

.DataBinding(dataBinding => dataBinding.Ajax().Select(

 

 

"_AjaxBinding", "Home")

 

 

.Insert(

 

 

"Insert", "Home")

 

 

.Update(

 

 

"Save", "Home")

 

 

.Delete(

 

 

"Delete", "Home"))

 

 

.Columns(c=>{

 

c.Bound(o=>o.Title);

 

c.Bound(o => o.Description);

 

c.Bound(o => o.ProjectStatus);

 

c.Bound(o => o.CreatedBy);

 

c.Bound(o => o.CreatedDate);

 

c.Command(commands =>

 

{ commands.Edit().ButtonType(

 

 

GridButtonType.Image);

 

 

commands.Delete().ButtonType(

 

 

GridButtonType.Image); }).Width(200);

 

 

}

 

)

 

.Pageable()

 

.Sortable()

 

.Filterable()

 

.Render();

 

}

Tags
Grid
Asked by
Nate
Top achievements
Rank 1
Share this question
or