.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

MVVM Modal Dialog.

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :WPF

Well, I faced with the common problem I can't find right solution for that.

My scenario:

I have a View, let say ViewA and I have the second View  - ViewB.

From the ViewA I call my command in the ViewModelA, show me ViewB.

In the ViewB i have two buttons (Save and Exit).

I can easily  handle the button Exit just by calling the static command from the View (Command="ApplicationCommands.Close"


<Button Content="Exit" Width="77" Command="ApplicationCommands.Close" Height="35 

View Complete Post

More Related Resource Links

Cutting Edge: Modal Dialog Boxes with AJAX


This month Dino Esposito shows you how to get Windows-style modal dialog boxes for your Web applications thanks to the Ajax Control Toolkit and some clever coding.

Dino Esposito

MSDN Magazine Launch 2008

Closing Javascript Modal dialog window after server side event processing


Hello Friends..

Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.

AMit..... InnocentInnocentInnocentInnocentInnocentInnocentInnocent

Refreshing a Jquery modal dialog after closing another Jquery modal dialog


I have one aspx page which contains a webpart. The structure of the webpart is:

Webpart(holds one user control say UC1)

      UC1-> contains another user control say (UC2) in a <div>, which I am going to show as a popup on clicking of a link button inside a gridview in UC1.

      UC2-> contain another user control say (UC3) in a <div>, which I am going to show as a popup on clicking of a button inside in UC2.

That means -> UC1(main page) ------->(Onclick) One JQuery popup(UC2)--------------->(OnClick) One Jquery popup(UC3) here UC2 is still remaining in focus and UC3 will be another Jquery popup on UC2.

Now my requirement is when i fill the Jquery popup(UC3) and click on save button in UC3, I would like to close UC3 Jquery popup and refresh the gridview inside UC2 Jquery popup without closing it.

Is this possible?(please explain the logic if found in terms of Jquery, but not in terms of normal popup windows)

Did anything change with modal dialog override GetCustomBuilder() in 2010?

I have several web parts in 2007 that override the GetCustomBuilder() method with the HtmlDesignerAttribute set to BrowserBuilderType.Dynamic in order to call aspx pages for custom UI on webbrowsable properties when you click the "..." in the EditorPart rather than just launching the default text area modal dialog. From http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.getcustombuilder.aspx it looks like everything is supposed to work the same way in 2010. But it's not. No matter what I've tried, the only thing I can get to load is the standard _layouts/zoombldr.aspx dialog. I even tried making a clone of zoombldr.aspx (named test.aspx), added another button to tell the difference and call it explicitly, but it didn't load. I've debugged and am confident GetCustomBuilder() is returning correct URLs to the custom aspx pages (and they load fine when requested directly). I've searched hi and lo without success in finding a solution. Any ideas? Many thanks!

WPF Window as Modal Dialog, strange behavior

Hopefully someone has a clue.... My application displays WPF Window as a modal dialog box. The dialog box has a few child user controls, one of which has combo box. When the user clicks this combo box to select... the whole dialog disappears except of the innards of the combo box. So the user only sees the list box of the combo box. Here are the details I got from the  client: The window itself is launched from non WPF application (Lotus Notes). This happens only on a few machines. The OS is Windows XP SP3. There is no issue with the parent handle, windows owner, etc... I've seen this behavior during the development phase, only when running under a debugger.    Thanks, Michael        

Custom Edit form - close modal dialog and navigate to page

Hi, I created one custom edit form for my document library, replaced default save and cancel buttons with input buttons and added the form action to them. Then I set my page as default edit form. When I click edit button, my custom form opens in modal pop up. When I try to save the item by clicking new save button, item gets saved but pop remains as it is. Now, I want the modal pop up to get closed and navigate to page other than the parent page with some parameters after I click save button. How can I achieve this? Thanks!!

reCaptcha+jquery ui modal dialog

Hi, I would like to have a contact form which contains a reCaptcha, and have that form inside a jquery ui modal dialog. All works well, except that I have a submit button for the form - which closes the modal dialog wether the recaptcha is valid or invalid. I tried adding onClientClick="return false;" to the submit button, but it still posts back, and closes the dialog. how do I remain inside the dialog ?

Refresh Parent Page List after Edit Item Modal Dialog Save/Close

I am calling the Edit Item URL (EditForm.aspx?ID=x&IsDlg=1) via javascript code to bring up the Edit Item Modal Dialog. This works fine and dandy. But what callbackfunction should I invoke after the Save so that the parent list is refreshed? Is there a better way to do it than call reload on the entire parent frame? It almost looks like there should be a way to refresh just the list. Any help appreciated. Thanks, Jake.

How to display a modal dialog from a BCS entity action?


I have implemented a BCS entity action which displays an aspx page to display some entity specific data. I want this aspx page to appear in a modal dialog using the new SharePoint 2010 dialog framework.

As far as I can tell, this is only possible via JS using SP.UI.ModalDialog.showModalDialog. But I don't seem to be able to call javascript from an entity action at all. I use entity.Actions.Create and action.ActionParameters.Create to create the entity action with the appropriate parameters. This works fine for my current aspx page, but this does not seem to work if the page should appear as modal dialog.

Any ideas how this can be achieved?


WPF/MVVM - Generic Dialog With Return Value


I'm trying to create a generic dialog in WPF using the MVVM pattern. The dialog's return value needs to be generic so it can return anything. In this case I want to return an instance of my DialogOptions class.

First, I created a DialogBase class that has a dependency property for the return value: 

using System;
using System.Windows;

namespace OutputCompare
  public class _DialogBase<T> : Window where T : new()
    public static readonly DependencyProperty RetValDP = DependencyProperty.Register("RetVal", typeof(T), typeof(_DialogBase<T>), new FrameworkPropertyMetadata());
    public T RetVal
      get { return (T)GetValue(RetValDP); }
        SetValue(RetValDP, value);

    public _DialogBase()
      RetVal = new T();
 Next I create a dialog based off it
<src:_DialogBase x:Class="OutputCompare.LoadDialog"
         RetVal="{Binding Option

microsoft visual studio cannot shut down because a modal dialog is active

if i get this message one more time I am going to put my fist through my monitor

What factors into the calculation of the width of modal dialog windows? (problems with custom master


I have a fairly customized masterpage and while the modal dialog boxes seem fine in Chrome and IE, they aren't rendering wide enough in firefox causing them to need to be horizontally scrolled.

I've figured out that it's not my stylesheet because when I deactivate it the problem still remains. When I try going back to v4.master it also works fine, so I'm mostly positive it's my masterpage.

I've tried going through and removing various customizations but nothing seems to resolve the issue. I'm thinking it may be related to the ribbon which I have detached from the top of the page.

I'm hoping if someone knows how the width of the modal window is calculated I might be able to track down the bug.

I wish I could just set the modal windows to use a different masterpage all together or have more easily accessible css. Maybe Sharepoint 2012? :)

Check out issue - authentication modal dialog on every checkout, Explorer View or Open With Windows



I got users that have an issue when trying to check out document, using the Explorer View or using Open With Windows Explorer.

Users are on Vista, IE 7 and Win 7, IE8

I have seen this Warning in the Application Event log:

"WMI ADAP was unable to retrieve data from the PerfLib subkey: SYSTEM\CurrentControlSet\Services\SSO\Performance\Library, error code: 0x80041009"

Any help would be very much appreciated!


SharePoint 2010 Modal dialog & Silverlight



I've got a silverlight application on my sharepoint site which open a ModalDialog.

This code adds JavaScript code to html :

    private void RegisterJavaScript()
      var script = HtmlPage.Document.CreateElement("script");
      script.SetAttribute("type", "text/javascript");

      var sb = new StringBuilder();
      sb.AppendLine("function showMyModalDialog(){");
      sb.AppendLine("  var options = {");
      sb.AppendLine("    url: '/Pages/Test.aspx',");
      sb.AppendLine("    width: 600,");
      sb.AppendLine("    height: 300,");
      sb.AppendLine("    dialogReturnValueCallback: DialogCallback,");
      sb.AppendLine("    allowMaximize: false,");

Hide Modal Dialog Close Button when dialog is already shown


Hey everyone,


Was wondering, how do you hide the close button of a modal dialog, when it's already shown, i.e. the page that's being loaded into the dialog, in there is a web part, and i want to trigger a script call to hide the close button of the current modal container.

I know you could give options to the modal dialog when you shot it to hide the close button, but not sure if you can do it after it has shown. I have no control of adding the option when it's showing the dialog, as this is done by the Add new item link in a list.




How to close the sharepoint modal dialog and refresh the parent page using Server side API?

I am trying to find a way to close a modal page that has been opened with the click event of ribbon control. Once the modal dialog is opened, I'm showing 'OK' button for the user to confirm some action on the respective list item. If the user clicks on 'OK', I'm performing some action on the listitem using server side code. Here the problem for me is, once the action is completed on this listItem, I need to close the dialog and refresh the parent page (AllItem.aspx) using *sharepoint server side

I'm aware that for closing the dialog we have JS code "SP.UI.ModalDialog.commonModalDialogClose". But this is not useful for me, because I should first run some action on the listitem and once that action is complete, then only I should close this dialog.

Modal Dialog height in SharePoint 2010


In SharePoint 2010, I know the Modal dialog height is calculated dynamically in Javascript. For some dialogs, I mean if the dialog is opening a edit form then it includes ribbon on top of it which reduces the height of the scrolling part and it really looks ugly. Is there any way to add ribbon height to modal dialog height so that unscrollable ribbon height doesn't affect the scrollable area height? Hope I am explaning it correct.

I would really appreciate, if anyone can reply for me.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend