Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:15:35+00:00 2026-06-02T13:15:35+00:00

I’m having problems submitting a form via AJAX to my controller. Other people with

  • 0

I’m having problems submitting a form via AJAX to my controller. Other people with similar error message seem to have issues around using interfaces as types on their controller method stub, I don’t have that issue. I’ve included my partial view and controller code, if I missed any information out just let me know. I suspect it has something to do with the creation of the model after I change the value in the drop down list, but the error message isn’t the most helpful so I’m a bit stuck!

My Partial View:

<% using (Ajax.BeginForm("RequestDetails", "Home", new { RequestId = Model.Request.RequestId, RequestStatus = Model.Request.Status }, new AjaxOptions
        {
            HttpMethod = "POST",
            InsertionMode = InsertionMode.Replace,
            UpdateTargetId = "Details"
        },
        new { @class = "jqtransform" }))
        {%>

        <%= Html.LabelFor(m => Model.Request.Name) %>
        <p><%= Html.Encode(Model.Request.Name)%>&nbsp;</p>
        <%= Html.LabelFor(m => Model.Request.Status) %>
        <% if (Html.IsAdmin(this.Page))
        {%>
            <div class="rowElem">
            <%=Html.DropDownListFor(m => Model.Request.Status, (IEnumerable<SelectListItem>)ViewData["requestStatus"], null, new { onchange = "this.form.submit();" })%>
            </div>
    <%  }
        else
        { %>
            <p><%= Html.Encode(Model.Request.Status.GetStringValue())%>&nbsp;</p>
        <% } }%>    

My Controller:

[HttpPost]
    public PartialViewResult RequestDetails(RequestDetailModel model, Guid RequestId, string RequestStatus)
    {
        if (ModelState.IsValid)
        {
            RequestMethods requestMethods = new RequestMethods();

            IRequest request = _requestRepo.GetRequestById(CurrentUser, RequestId, CompanyId);

            requestMethods.UpdateRequestStatus(request, CurrentUser, model.NewComment, model.Request.Status);

        }

        model.Request = _requestRepo.GetRequestById(CurrentUser, RequestId, CompanyId);

        return PartialView(model);
    }

The exact error thrown is:

Cannot create an instance of an interface.

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:15:36+00:00Added an answer on June 2, 2026 at 1:15 pm

    You haven’t shown your RequestDetailModel object but if there are properties that are interface type the default model binder is not able to populate them. For example if you have the following:

    public class RequestDetailModel 
    {
        public IRequest Request { get; set; }
    }
    

    where IRequest is an interface or an abstract class this won’t work. If you want to use interfaces in your models you will need to write a custom model binder. Here’s one example of such custom model binder that works with abstract classes but interfaces would be the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.