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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:48:19+00:00 2026-05-28T04:48:19+00:00

I am using a partial view that is displayed in a pop up to

  • 0

I am using a partial view that is displayed in a pop up to edit the details of a record that is clicked on in the main window. On this view, the user can edit, delete or cancel. When the detail record is edited or deleted successfully, I want to close the partial view and update the main window. Right now, on delete, my main view is reloading in my pop up on success.

Any help getting this to work is greatly appreciated.

The HTML:

`<a href="javascript:popup('@Url.Action("EditCaseEmployer/" + item.Id, "CaseOptions")')">@item.StartDate.ToShortDateString()</a>`

Here are the custom javascript functions to popup a window:

function popup(url) {
window.open(url, 'notes', 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
}
function popup(url, windowName) {
window.open(url, windowName, 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
}
  • 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-28T04:48:20+00:00Added an answer on May 28, 2026 at 4:48 am

    You could add a boolean property to the view model that you are using in your partial:

    public class MyViewModel
    {
        public MyViewModel()
        {
            ShouldReload = false;
        }
        public bool ShouldReload { get; set; }
    
        // Some properties
        public string Foo { get; set; }
    }
    

    and then in the partial test its value and refresh the opener and close the popup:

    @model MyViewModel
    
    @if (Model.ShouldReload)
    {
        <script type="text/javascript">
            // refresh the parent window
            window.opener.location.reload();
    
            // close the popup
            window.close();
        </script>
    }
    else
    {
        using (Html.BeginForm())
        {
            @Html.LabelFor(x => x.Foo)
            @Html.EditorFor(x => x.Foo)
            <button type="submit">OK</button>
        }
    }
    

    Now all that’s left are the 2 controller actions that will be used to respectively show the partial and process it:

    public ActionResult Dialog()
    {
        var model = new MyViewModel();
        return PartialView(model);
    }
    
    [HttpPost]
    public ActionResult Dialog(MyViewModel model)
    {
        if (!ModelState.IsValid)
        {
            // the model is invalid => redisplay the partial
            return PartialView(model);
        }
        // TODO: at this stage the model is valid 
        // => pass it to the service layer for processing
    
        // everything went fine => set the ShouldReload flag to true
        // so that the view refreshes its opener and closes itself
        model.ShouldReload = true;
        return PartialView(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MVC2 with VS2010 I have a view that has two partial views
I have a partial view that has something like this <%= Html.DropDownListFor(m => m.SelectedProductName,
I have a strongly typed partial view CheckBox.ascx that renders a checkbox. This is
I have a partial view that when the user clicks a button, some data
I am loading a partial view into a main view using ajax but struggling
I have the following code in a partial view (using Spark): <span id=selectCount>0</span> video(s)
I am using Ajaxy Call to load the partial view. It is working fine
Using the following JQuery/AJAX function I'm calling a partial view when an option is
I'm currently re-using a partial on two different views. View A View B The
Using IE8's developer mode, I see that select lists are implemented using partial postbacks.

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.