Reputation: 13955
I inherited a rather old MVC project that had a Grid package installed, Grid.MVC
. It is used extensively, and taking it out or replacing it is not an option (client won't pay for it.)
We just built out a new portal section to the site, and in it, we used a new (and better) grid, NonFactors.Grid.Core.MVC5. Much more features and options.
But here's the problem. In all the places where the old grid is used, I now get this run-time error:
The call is ambiguous between the following methods or properties: 'NonFactors.Mvc.Grid.MvcGridExtensions.Grid(System.Web.Mvc.HtmlHelper, System.Collections.Generic.IEnumerable)' and 'GridMvc.Html.GridExtensions.Grid(System.Web.Mvc.HtmlHelper, System.Collections.Generic.IEnumerable)'
This should be a simple fix. All I need to do is tell the old grids which one they are. But i'm not figuring out the syntax. In the view's, they all have a @using
which points to the correct (old) version.
@using GridMvc.Html
....
@Html.Grid(Model.Leads).Named("userGrid").Selectable(false).Columns(c =>
{
....
}
A pic might be more helpful:
I've tried various means of a full path in the view, but the syntax is never right...
@GridMvc.Html.GridExtensions.Grid(Model.Leads).... // Nope
@Html.GridMvc.Html.GridExtensions.Grid(Model.Leads).... // Nope
etc etc etc.
Again, this is probably simple. I'm just not getting it.
Upvotes: 2
Views: 716
Reputation: 307
Disable one of the grid templates from the web.config in the views folder. -->
Upvotes: -1
Reputation: 16609
Extension methods are callable as standard static methods, but just take the parent type as a first parameter, so you should be able to pass the HtmlHelper
as so:
@GridMvc.Html.GridExtensions.Grid(Html, Model.Leads)
Upvotes: 2
Reputation: 1039298
Try passing the HtmlHelper
instance as first argument to the extension method:
@NonFactors.Mvc.Grid.MvcGridExtensions.Grid(Html, Model.Leads)
@GridMvc.Html.GridExtensions.Grid(Html, Model.Leads)
Upvotes: 2