I have a Kendo grid generated using the ASP.NET MVC Wrapper on my cshtml page. I bind the columns using a GridColumnSettings[] prepared in the Action method for the controller and pushed to the ASP.NET page through the ViewData structure.
.Columns(columns =>
{
columns.LoadSettings((GridColumnSettings[])ViewData["OrderReviewGrid"]);
})
The action methods builds the GridColumnSettings[ ] programmaticaly. After the grid is rendered for the first time, the GridColumnSettings[ ] for this particular grid are saved in the user's Profile. Any changes to the column settings on the UI e.g Column Resize, Hide, Show etc are captured and sent back on the server and updated in the saved GridColumnSettings[ ] in the user's profile.
The intention here is to be able to get the saved configuration the next time the user visit's the page.
But on the following request to the page, when the Grid is created, this time the GridColumnsSettings[] is loaded from the cached copy in the user's profile. When this is pushed to the ASP.NET page, I get the following exception on the ASP page during the MVC Wrapper execution.
I have inspected the two structures, the default created, and the one saved and retrieved from the profile. They are exactly the same in terms of field-by-field compare.
Thanks in Advance if anyone can find what's going wrong.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Web.Routing.RouteValueDictionary.Add(String key, Object value) at Kendo.Mvc.UI.GridBoundColumn`2.CreateHeaderBuilderCore() at Kendo.Mvc.UI.GridColumnBase`1.CreateHeaderBuilder() at Kendo.Mvc.UI.Html.GridCellBuilderFactory.CreateHeaderCellBuilder(IGridColumn column) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at Kendo.Mvc.UI.Html.GridRowBuilder.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridDataSectionBuilder.CreateHeader(GridRenderingData data) at Kendo.Mvc.UI.Html.GridScrollingHtmlBuilder.CreateHeader(GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridHtmlBuilder.AppendHeader(IHtmlNode container, GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridScrollingHtmlBuilder.AppendData(IHtmlNode div, GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridHtmlBuilder.CreateGrid(IDictionary`2 htmlAttributes, GridFunctionalData functionalData, GridRenderingData renderingData) at Kendo.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) at Kendo.Mvc.UI.WidgetBase.ToHtmlString() at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() at System.Web.HttpUtility.HtmlEncode(Object value) at System.Web.WebPages.WebPageBase.Write(Object value) at ASP._Page_Areas_FR_Views_OrderReview_Index_cshtml.Execute() in
.Columns(columns =>
{
columns.LoadSettings((GridColumnSettings[])ViewData["OrderReviewGrid"]);
})
The action methods builds the GridColumnSettings[ ] programmaticaly. After the grid is rendered for the first time, the GridColumnSettings[ ] for this particular grid are saved in the user's Profile. Any changes to the column settings on the UI e.g Column Resize, Hide, Show etc are captured and sent back on the server and updated in the saved GridColumnSettings[ ] in the user's profile.
The intention here is to be able to get the saved configuration the next time the user visit's the page.
But on the following request to the page, when the Grid is created, this time the GridColumnsSettings[] is loaded from the cached copy in the user's profile. When this is pushed to the ASP.NET page, I get the following exception on the ASP page during the MVC Wrapper execution.
I have inspected the two structures, the default created, and the one saved and retrieved from the profile. They are exactly the same in terms of field-by-field compare.
Thanks in Advance if anyone can find what's going wrong.
Exception Details:
An item with the same key has already been added.at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Web.Routing.RouteValueDictionary.Add(String key, Object value) at Kendo.Mvc.UI.GridBoundColumn`2.CreateHeaderBuilderCore() at Kendo.Mvc.UI.GridColumnBase`1.CreateHeaderBuilder() at Kendo.Mvc.UI.Html.GridCellBuilderFactory.CreateHeaderCellBuilder(IGridColumn column) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at Kendo.Mvc.UI.Html.GridRowBuilder.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() at Kendo.Mvc.UI.Html.GridDataSectionBuilder.CreateHeader(GridRenderingData data) at Kendo.Mvc.UI.Html.GridScrollingHtmlBuilder.CreateHeader(GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridHtmlBuilder.AppendHeader(IHtmlNode container, GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridScrollingHtmlBuilder.AppendData(IHtmlNode div, GridRenderingData renderingData) at Kendo.Mvc.UI.Html.GridHtmlBuilder.CreateGrid(IDictionary`2 htmlAttributes, GridFunctionalData functionalData, GridRenderingData renderingData) at Kendo.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) at Kendo.Mvc.UI.WidgetBase.ToHtmlString() at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() at System.Web.HttpUtility.HtmlEncode(Object value) at System.Web.WebPages.WebPageBase.Write(Object value) at ASP._Page_Areas_FR_Views_OrderReview_Index_cshtml.Execute() in