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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:29:02+00:00 2026-05-30T08:29:02+00:00

I have an @Ajax.BeginForm for my model which has a boolean value ( @Html.CheckBoxFor

  • 0

I have an @Ajax.BeginForm for my model which has a boolean value (@Html.CheckBoxFor). If this is checked, I want my HttpPost action to redirect to a new page. Otherwise I want it to just continue being an @Ajax.BeginForm and update part of the page.

Here is my HttpPost action (Note: Checkout is the boolean value in my model)

Controller:

    [HttpPost]
    public ActionResult UpdateModel(BasketModel model)
    {
        if (model.Checkout)
        {
            // I want it to redirect to a new page
            return RedirectToAction("Checkout");
        }
        else
        {
            return PartialView("_Updated");
        }
    }
  • 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-30T08:29:04+00:00Added an answer on May 30, 2026 at 8:29 am

    You could use JSON and perform the redirect on the client:

    [HttpPost]
    public ActionResult UpdateModel(BasketModel model)
    {
        if (model.Checkout)
        {
            // return to the client the url to redirect to
            return Json(new { url = Url.Action("Checkout") });
        }
        else
        {
            return PartialView("_Updated");
        }
    }
    

    and then:

    @using (Ajax.BeginForm("UpdateModel", "MyController", new AjaxOptions { OnSuccess = "onSuccess", UpdateTargetId = "foo" }))
    {
        ...
    }
    

    and finally:

    var onSuccess = function(result) {
        if (result.url) {
            // if the server returned a JSON object containing an url 
            // property we redirect the browser to that url
            window.location.href = result.url;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some difficulties with Ajax.BeginForm I have something like this in a view
I have a mvc2 application with a view like this <% using (Ajax.BeginForm(UserApprove, new
i have a jquery Dialog in a partial view: @model JQueryDialogPoc.Models.FeedBack @using (Ajax.BeginForm(GiveFeedback, Home,
I have the following form in a partial view @model PartDetail @using (Ajax.BeginForm(Create, Part,
Background: I have a popup which lets me create a company, this popup has
I have following code @using (Html.BeginForm()) { @Html.DropDownListFor(m => m.IDs, new SelectList(Model. IDs), Model.SelectedID)
In my html I have <h2>Title goes here</h2> @using (Html.BeginForm(Action, Controller, FormMethod.Post, new {
I have an ASP.Net MVC Ajax.BeginForm that submits and updates my page properly when
I have an MVC view with a form built with the Ajax.BeginForm() helper method,
I have 2 validation forms on page. <div id='LogOn' style=background-color: White;> @using (Ajax.BeginForm(LogOnAjax, Home,

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.