Here is what I've got:
Controller:
{
var model = new Zeus.Models.SiteModels();
Models.Site[] sites = model.List(50, 1);
return View(sites.ToList());
}
View:
@{
ViewBag.Title = "TestIndex";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>TestIndex</h2>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Name).Groupable(false);
columns.Bound(p => p.Address1);
columns.Bound(p => p.CityName);
columns.Bound(p => p.OwnerGroupName);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
)
I get an error:
Any idea why?
Controller:
public ActionResult TestIndex(){
var model = new Zeus.Models.SiteModels();
Models.Site[] sites = model.List(50, 1);
return View(sites.ToList());
}
View:
@model IEnumerable<Zeus.Models.Site>@{
ViewBag.Title = "TestIndex";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>TestIndex</h2>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Name).Groupable(false);
columns.Bound(p => p.Address1);
columns.Bound(p => p.CityName);
columns.Bound(p => p.OwnerGroupName);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
)
I get an error:
[ArgumentOutOfRangeException: Index must be within the bounds of the List.<
br
>Parameter name: index]<
br
> System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +64<
br
> System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item) +9573490<
br
> Kendo.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) +365<
br
> Kendo.Mvc.UI.WidgetBase.ToHtmlString() +86<
br
> Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() +22
Any idea why?
7 Answers, 1 is accepted
0
Hello Jeff,
Rosen
the Telerik team
It is not clear what may be the cause for such error looking at the provided details. Therefore, could you please send us a small runnable sample in which this behavior can be observed locally.
Greetings,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Jeff
Top achievements
Rank 1
answered on 19 Mar 2013, 06:04 PM
In testing, I identified that unless I had this it didn't work, so now I'm moving forward:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
0

Sargis
Top achievements
Rank 1
answered on 22 Apr 2013, 02:40 PM
Hi Guys,
I have exactly the same error as Jeff, could you please share what is the solution???
I have exactly the same error as Jeff, could you please share what is the solution???
0
Hello Sargis,
Rosen
the Telerik team
Judging from the info provided by Jeff, it seems that the issue is caused by incorrect project setup. Therefore, please refer to this help article on how to setup a ASP.NET MVC project to be used with KendoUI.
All the best,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Sargis
Top achievements
Rank 1
answered on 25 Apr 2013, 11:55 AM
Hi Rosen,
thank you very much, article link helped me, the problem is solved.
thank you very much, article link helped me, the problem is solved.
0

Makarand
Top achievements
Rank 1
answered on 29 Oct 2013, 07:34 AM
Hello
I have exactly the same error as Jeff, could you please share what is the solution..
my controller is:--
public ActionResult UpdateArrival(FormCollection frmcoll)
{
List<Attendee> atList = new List<Attendee>();
String AttendeeData = frmcoll["txtAttendeeId"];
String[] splitAttendeeData = AttendeeData.Split(',');
for (int i = 0; i < splitAttendeeData.Length; i++)
{
String[] splitAttendeeActData = splitAttendeeData[i].Split(':');
Attendee at = new Attendee();
at.AttendeeId = new Guid(splitAttendeeActData[0].ToString());
at.LastName = splitAttendeeActData[2].ToString();
at.FirstName = splitAttendeeActData[1].ToString();
at.RefernceId = splitAttendeeActData[3].ToString();
atList.Add(at);
}
ViewData["AttendeeData"] = atList;
return View();
}
and Razor is like
var grid = $("#grid").data("kendoGrid");
//Grid definition [Populate grid with combobox,textbox]
@(Html.Kendo().Grid((IEnumerable<EMSModel.Attendee>)ViewData["AttendeeData"])
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.AttendeeId);
columns.Bound(p => p.FirstName);
columns.Bound(p => p.LastName);
columns.Bound(p => p.ActionRequired);
columns.Bound(p => p.AttendeeComment);
})
)
please give me some solution
Regards
Vinay
I have exactly the same error as Jeff, could you please share what is the solution..
my controller is:--
public ActionResult UpdateArrival(FormCollection frmcoll)
{
List<Attendee> atList = new List<Attendee>();
String AttendeeData = frmcoll["txtAttendeeId"];
String[] splitAttendeeData = AttendeeData.Split(',');
for (int i = 0; i < splitAttendeeData.Length; i++)
{
String[] splitAttendeeActData = splitAttendeeData[i].Split(':');
Attendee at = new Attendee();
at.AttendeeId = new Guid(splitAttendeeActData[0].ToString());
at.LastName = splitAttendeeActData[2].ToString();
at.FirstName = splitAttendeeActData[1].ToString();
at.RefernceId = splitAttendeeActData[3].ToString();
atList.Add(at);
}
ViewData["AttendeeData"] = atList;
return View();
}
and Razor is like
var grid = $("#grid").data("kendoGrid");
//Grid definition [Populate grid with combobox,textbox]
@(Html.Kendo().Grid((IEnumerable<EMSModel.Attendee>)ViewData["AttendeeData"])
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.AttendeeId);
columns.Bound(p => p.FirstName);
columns.Bound(p => p.LastName);
columns.Bound(p => p.ActionRequired);
columns.Bound(p => p.AttendeeComment);
})
)
please give me some solution
Regards
Vinay
0
Hello Makarand,
Rosen
Telerik
As Jeff mentioned, his project was missing the binding redirects, which are described in the article I have already provided.
Regards,Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!