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 6587905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:58:44+00:00 2026-05-25T16:58:44+00:00

I have an MVC3 Razor form in index.cshtml using HtmlHelper . It works, but

  • 0

I have an MVC3 Razor form in index.cshtml using HtmlHelper. It works, but I want to replace it with Ajax form using AjaxHelper (note: I am still not familiar to Ajax/jQuery). It fails. My questions:

  1. What’s wrong with my code?
  2. Are there any good websites that explain this kind of transformation?
  3. If one transforms a view to Ajax processing, is it necessary to change the controller as well?

Here’s my index.cshtml file. My trial with Ajax is commented out below the MVC3 form.

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script>

@using ( Html.BeginForm("UploadFile", "Home", FormMethod.Post, new
{
    enctype = "multipart/form-data"
}) )
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Select a file</legend>
        <input type="file" id="fileupload" name="fileuploadname" />
        <p>
            <input type="submit" value="Upload" id="upload" onclick="javascript:document.getElementById('upload').disabled=true; document.getElementById('upload').value='Uploading...'" />
        </p>
    </fieldset>
}

@* @using ( Ajax.BeginForm("UploadFile", "Home",
                new AjaxOptions
                {
                    InsertionMode = InsertionMode.Replace,
                    HttpMethod = "POST"
                }) )
{
    <input type="file" id="fileupload" name="fileuploadname" />
    <p>
        <input type="submit" value="Upload" id="upload" onclick="javascript:document.getElementById('upload').disabled=true; document.getElementById('upload').value='Uploading...'" />
    </p>
}
*@

Thx in advance.

  • 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-05-25T16:58:44+00:00Added an answer on May 25, 2026 at 4:58 pm

    You can’t upload files using Ajax. At least not directly.

    There are of course few plugins that help you with this, but they qork outside of AjaxHelper scope. This simply means you will have to get your hands dirty with jQuery which is also a good thing. It’s a simple and small library and while getting acquainted with it you’ll most likely deviate away from AjaxHelper and rather just use jQuery (with HtmlHelper).

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

Sidebar

Related Questions

Using MVC3, C#, and the Razor View Engine: I have a form that has
I am working on an MVC3 application using the Razor syntax and I have
I had created a webpage using asp.net mvc3 razor. I have two master pages
I have a string created using asp.net MVC3 Razor block like this: @{ var
I have online form builder appplication in ASP.NET MVC3 with Razor views. It is
I have an href in my asp.net MVC3 Razor view and I want to
I'm using jquerymobile and asp.net MVC3 razor. I'm somewhat new to this, but figuring
I have an asp.net mvc3 Razor app being developed in VS2010 using Git for
I have upgraded to MVC3 and Razor, everything works fine. However, in my return
I have a Razor MVC3 project which has two user records in a form,

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.