This question is locked. New answers and comments are not allowed.
Here is my situation:
I've introduced the (awesome) grid control and got it working fine on my dev environment.
I deployed my site to my local dev server and got the following error:
3.5 framework SP1
The version of the site which is having the error is using MVC R2 (System.Web.Mvc is version 2.0.40724.0)
The View code is below:
I was able to resolve this error by uninstalling MVC R2 and replacing it with MVC R2v2 (this environment also required an update of VS2008 sp and update of 3.5 framework Sp as well b/c VS is installed on this box), and then everything worked fine.
My problem is, the PHB won't allow me to update the version of MVC on our System Testing environment from MVC R2.
The requirements for the Telerik MVC controls don't specify MVC R2v2 as required, but the only blog posting that was close to addressing the problem suggested this and it seemed to work.
My local version and the dev site version of System.Web.Mvc is v2.0.50727
Help me Obi Wan! You're my only hope!
I've introduced the (awesome) grid control and got it working fine on my dev environment.
I deployed my site to my local dev server and got the following error:
| Could not load type 'System.Web.Mvc.ModelMetadata' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. |
| Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
| Exception Details: System.TypeLoadException: Could not load type 'System.Web.Mvc.ModelMetadata' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. |
| Source Error: |
| Line 10: .Columns(columns => |
| Line 11: { |
| Line 12: columns.Bound(x => x.Id); |
| Line 13: columns.Bound(x => x.RequestTypeCode); |
| Line 14: columns.Bound(x => x.ReceiptNumber).Title("Receipt #").Width(85); |
| Source File: d:\Inetpub\wwwroot\LTRS\Web\Views\Search\_SearchList.ascx Line: 12 |
| Stack Trace: |
| [TypeLoadException: Could not load type 'System.Web.Mvc.ModelMetadata' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.] |
| Telerik.Web.Mvc.UI.GridBoundColumn`2..ctor(Grid`1 grid, Expression`1 expression) +0 |
| Telerik.Web.Mvc.UI.Fluent.GridColumnFactory`1.Bound(Expression`1 expression) +80 |
| ASP.views_search__searchlist_ascx.<__Render__control1>b__7(GridColumnFactory`1 columns) in d:\Inetpub\wwwroot\LTRS\Web\Views\Search\_SearchList.ascx:12 |
| Telerik.Web.Mvc.UI.Fluent.GridBuilder`1.Columns(Action`1 configurator) +107 |
| ASP.views_search__searchlist_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\Inetpub\wwwroot\LTRS\Web\Views\Search\_SearchList.ascx:8 |
| System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256 |
| System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 |
| System.Web.UI.Control.Render(HtmlTextWriter writer) +10 |
| System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 |
| System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 |
| System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 |
| System.Web.UI.Page.Render(HtmlTextWriter writer) +29 |
| System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +59 |
| System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266 |
The version of the site which is having the error is using MVC R2 (System.Web.Mvc is version 2.0.40724.0)
The View code is below:
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Ltrs.Data.Transaction>>" %> |
| <%@ Import Namespace="MvcContrib.UI.Grid" %> |
| <% |
| int pageSize = 10; |
| SelectList select = ViewData["Take"] as SelectList; |
| int.TryParse(select.SelectedValue.ToString(), out pageSize); |
| Html.Telerik().Grid(Model) |
| .Name("Grid") |
| .Columns(columns => |
| { |
| columns.Bound(x => x.Id); |
| columns.Bound(x => x.RequestTypeCode); |
| columns.Bound(x => x.ReceiptNumber).Title("Receipt #").Width(85); |
| columns.Bound(x => x.CheckNumber).Title("Check #").Width(85); |
| columns.Bound(x => x.RequesterName).Title("Requestor").Width(120); |
| columns.Bound(x => x.StatusTypeCode).Title("Status"); |
| columns.Bound(x => x.RequestDate).Format("{0:MM/dd/yyyy}").Title("Requested"); |
| }) |
| .DataBinding(dataBinding => dataBinding.Ajax().Select("_Paging", "Search")) |
| .Pageable( |
| paging => paging.PageSize(pageSize) |
| .Style(GridPagerStyles.NextPreviousAndNumeric) |
| .Position(GridPagerPosition.Bottom) |
| ) |
| .Sortable(sorting => sorting.Enabled(true)) |
| .Scrollable(scrolling => scrolling.Enabled(true)) |
| .Selectable().ClientEvents(events => events.OnRowSelected("onRowSelected")).RowAction(row => { row.Selected = row.DataItem.Id.Equals(ViewData["id"]); }) |
| .Filterable(filtering => filtering.Enabled(true)) |
| .Render(); |
I was able to resolve this error by uninstalling MVC R2 and replacing it with MVC R2v2 (this environment also required an update of VS2008 sp and update of 3.5 framework Sp as well b/c VS is installed on this box), and then everything worked fine.
My problem is, the PHB won't allow me to update the version of MVC on our System Testing environment from MVC R2.
The requirements for the Telerik MVC controls don't specify MVC R2v2 as required, but the only blog posting that was close to addressing the problem suggested this and it seemed to work.
My local version and the dev site version of System.Web.Mvc is v2.0.50727
Help me Obi Wan! You're my only hope!