"A route named 'AjaxBindingCompleted' could not be found in the route collection.
Parameter name: name"
in the .cshtml class.
How do i solve this error? I am binding the async method as follows:
List<
Account
> posquity = Model.ListOfAllPositions.FindAll(Account accPosDetails) ;
Html.Telerik().Grid(posquity).Name("grdPersonView")
.DataBinding(databinding => databinding.Ajax()
.Select("AjaxBinding","Person"))
.Columns(columns =>
{
columns.Bound(p => p.Number);
columns.Bound(p => p.Value);
columns.Bound(p => p.Name).Width(100);
[GridAction]
public ActionResult AjaxBindingCompleted(AccountPositions accountPositions, Dictionary<
string
, CMSContent> cmsContent, bool hasServiceError)
{
MarginViewModel viewModel = new MarginViewModel();
List<
MarginViewModel
> viewModelList = new List<
MarginViewModel
>();
viewModelList.Add(viewModel);
return View(new GridModel(viewModelList));
}
public void AjaxBindingAsync(AccountInput account)
{
........
}
7 Answers, 1 is accepted
UPDATED:
You should add the GridAction attribute to the method which ends with Async. When configuring the grid specify the method name without "Async".
Find attached a working project.
Atanas Korchev
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Did you check the updated project? I updated my reply shortly after posting.
Greetings,Atanas Korchev
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
I checked the project that you had uploaded. I have followed the same steps for implementation. The only difference is that while you are using a single method "index" for binding and paging, I am using two methods. I am using Index for basic binding and AjaxBinding for paging. I can't use a single method "index" for both the operations as Index is being used by other grids on the page.
The problem is that when i click the next page, I get an error 404 - Url could not be found. Could I be getting this error because I am using 2 different methods here? Can you give some insight here?
Thanks.
I am not sure what went wrong at your side.To repeat you need to do the following when doing ajax binding with async methods:
1. Create two methods e.g. SelectAsync and SelectComplete.
2. Configure the grid to bind to "Select" (not SelectAsync or SelectComplete):
.DataBinding(dataBinding=> dataBinding.Ajax().Select(
"Select"
,
"Home"
))
[GridAction]
public
void
SelectAsync()
{
}
4. Use GridModel in SelectComplete:
public
ActionResult SelectCompleted()
{
return
View(
new
GridModel(
new
[] {
new
Product { ID = 1, Name =
"Product 1"
} }));
}
Atanas Korchev
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!