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

  • Home
  • SEARCH
  • 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 598923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:26:31+00:00 2026-05-13T16:26:31+00:00

So I have this ascx (partialView) control – ControlTemp I have an ajax.BeginForm inside

  • 0

So I have this ascx (partialView) control – ControlTemp

I have an ajax.BeginForm inside ControlTemp like this:

<% using (Ajax.BeginForm("ControlTemp",  new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "divControlTemp" })) {
        ....
        <input type = "submit"  />
        <%}%>

Inside my masterpage, I am using this partialView as

<div id = "divControlTemp">  <% Html.RenderAction("ControlTemp", "Home", null); %></div>

Now the problem is if I have a page that is using this master page and the page does a postback to post, this function is also being fired:

[ActionName("ControlTemp"), AcceptVerbs(HttpVerbs.Post)]
        public ActionResult ControlTemp(string URL)
        {
            ...
            return PartialView("ControlTemp");
        }

NOTE: Even if I use Html.BeginForm instead of Ajax.BeginForm, the above methods still ends up being triggered

The page that is using this masterpage:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
   Log On
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
   <h2>Log On</h2>
<p>
    Please enter your username and password. <%= Html.ActionLink("Register", "Register") %> if you don't have an account.
</p>
<%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>

**<% using (Html.BeginForm("LogOn", "Account")) { %>**
    <div>
        <fieldset>
            <legend>Account Information</legend>
            <p>
                <label for="username">Username:</label>
                <%= Html.TextBox("username") %>
                <%= Html.ValidationMessage("username") %>
            </p>
            <p>
                <label for="password">Password:</label>
                <%= Html.Password("password") %>
                <%= Html.ValidationMessage("password") %>
            </p>
            <p>
                <%= Html.CheckBox("rememberMe") %> <label class="inline" for="rememberMe">Remember me?</label>
            </p>
            <p>
                <input type="submit" value="Log On" />
            </p>
        </fieldset>
    </div>
<% } %>

See the Html.BeginForm in above code… The LogOn ActionMethod is being fired, but it is firing ActionMethod of this another form as well!

Another person posted this problem, but s/he did not have a solution:

POST method called on MVC UserControls as well as their parent views

Note: There are no nested forms

  • 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-13T16:26:32+00:00Added an answer on May 13, 2026 at 4:26 pm

    The problem is that MVC replicates HTTP method from parent view for every RenderAction() call in it no matter whether its form has actually issued a postback or not.

    You will have to create your own functionality the way that I did. I’ve rewritten this so I can call Html.RenderAction(HttpVerb.Get, ... ). This makes it possible to always render some action as GET, no matter whether containing page is a POST call. In your case this would solve the problem, because rendering the partial view (with ajax form) on your master should always be called as GET. You Ajax makes POSTs anyway.

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

Sidebar

Related Questions

I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the
I have controls like Textbox, dropdown on my CustomerDetails.ascx partialview. Now can we do
I have this infoflyout.ascx <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<dynamic> %> <script type=text/javascript> $(document).ready(function () {
I have an ascx control loaded inside a panel tied to a modal pop
I have LogOn.ascx control which is located on master page site.master: <% Html.RenderPartial(LogOn); %>
I have an index page for listing products. From this page I would like
I would like to have both these views: ~/Views/Customer/Index. aspx ~/Views/Customer/Index. ascx I would
I have a ViewPage , Index.aspx. In it, I have: <%= Html.Partial(~/Index/ViewUserControl/Promo.ascx, new PromoViewModel());
I have found this example on StackOverflow: var people = new List<Person> { new
I have this code in jQuery, that I want to reimplement with the prototype

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.