Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vishal Joshi 5 posts 25 karma points
    Feb 24, 2012 @ 09:32
    Vishal Joshi
    0

    ModelMetadataProvider Issue

    Hi

    I am new to Umbraco. I am implementing the checkboxList control in our project. I am getting following error sporadically

    -------------------------------------------------------------------------

    Server Error in '/Umbraco5RTMWork' Application.
    An instance of ModelMetadataProvider was found in the resolver as well as a custom registered provider in ModelMetadataProviders.Current. Please set only one or the other.
    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.InvalidOperationException: An instance of ModelMetadataProvider was found in the resolver as well as a custom registered provider in ModelMetadataProviders.Current. Please set only one or the other.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: An instance of ModelMetadataProvider was found in the resolver as well as a custom registered provider in ModelMetadataProviders.Current. Please set only one or the other.]
       System.Web.Mvc.SingleServiceResolver`1.get_Current() +369
       System.Web.Mvc.ModelMetadataProviders.get_CurrentInternal() +24
       System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +303
       System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +153
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825600
       System.Web.Mvc.Controller.ExecuteCore() +159
       System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
       System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
       System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
       System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

    -----------------------------------------------------------------------------

    When I comment the @Html.CheckboxListFor line, page gets reneder.

    I wrote one custom class that extends

    DefaultModelBinder
     from using System.Web.Mvc
     namespace

     

    later on I register this in Global.asax.cs file as

     ModelBinders.Binders.DefaultBinder = new DefaultGraphModelBinder(); 

    I am not getting the selected items from the checkboxlist control after POST in controller. I guess model binding is the problem

    Can any one please help.

     

    Thanks in anticipation

     

     

    
    
                    
Please Sign in or register to post replies

Write your reply to:

Draft