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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:49:39+00:00 2026-05-24T05:49:39+00:00

Background: I have a popup which lets me create a company, this popup has

  • 0

Background:

I have a popup which lets me create a company, this popup has a text field called company name, and this is a required field (using the [Required] data annotation on the backing view model).

<div class="popup-editor">
    <h4 class="popup-title">
    Add new Company</h4>
    @using (Ajax.BeginForm("Create", "Company", new AjaxOptions { UpdateTargetId = "popup-editor", OnSuccess = "$.validator.unobtrusive.parse('form');" },))
    {
        @Html.ValidationSummary(true);
        <table>
            <tr>
               <td class="label">
                   Company Name
               </td>
               <td class="editor-field">
                    @Html.EditorFor(x => x.Name)
                    @Html.ValidationMessageFor(x => x.Name)
               </td>
            </tr>
        </table>
        <div class="popup-buttons">
            <a href="#" onclick="return togglePopupEditor();">Cancel</a>
            <input type="submit" value="Add Company" />
        </div>
     }
</div>

Now the validation works correctly and the ajax lets me show an error message in the popup when the name field is empty.

Problem:

When there are no validation errors I need to be able to redirect to a new page (company details page), but instead this page is inserted into the div where the popup contents were. For example:

public ActionResult Create(CreateCompanyModel model)
{
        if(!ModelState.IsValid)
        {
            return PartialView("_AddCompanyEditor");
        }

        Company c = CompanyService.Create(model.Name);
        return RedirectToAction("Details", new { companyId = c.Id });
}

Is there any way to either; force a complete redirect for the entire page, or switch to a standard HTML form?

  • 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-24T05:49:40+00:00Added an answer on May 24, 2026 at 5:49 am

    Not really. Browsers handle AJAX redirects without notifying the calling javascript of what happened. One option would be to return a small snippet of HTML that contains a javascript tag that redirects the page. The jQuery handling on the client side should pick that up and run it.

    Most other options would involve changing your AjaxOptions to run a method that watches for something specific in the results and acts in a different way depending on the response. For the project I work on currently, we have all of our AJAX requests go through a special “event framework,” so that different actions can be performed depending on which events get returned from the controller action.

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

Sidebar

Related Questions

Background: I have this with rollup query defined in MySQL: SELECT case TRIM(company) when
I have a popup using div and javascript in a jsp page which also
Background I have a dimension table that has a single record for each day.
Background I have a custom collection that is binded to the datagridview this.datagridview.DataSource =
Background : I have an Apple Dashcode v3 project in which there is a
Is it possible that BroadcastReceiver in an activity which have gone to background receiving
I have requirement for an application which work in background only. When first time
I have in my page a button which when clicked displays a div (popup
I have a script embedded in a page, which is as follows: <script type=text/javascript>
I have made a popup, which works fine, but I'd like to write to

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.