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

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

Returning Exceptions from Thread to Main GUI and Throwing Modal Dialog Box

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework

If I have a thread running and it encounters (and handles) an exception, how can I return that information to the main gui such that the Main Form can throw a modal dialog box?  Are there any obvious patterns for this that I'm missing?  Please include the code, if you can.

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)

WebFaultException throwing a "not handled by user code" error and returning an HTTP 500 to the clien

I am trying to return a BadRequest and simple message when implentation throws an error in a WCF REST service, but the WebFaultExcption itself is throwing an exception and returning an HTTP 500 instead. Any ideas on why this might be happening? Here is a short code snippet: [WebDispatchFormatter] [WebHelp(Comment="Initiate an immediate or callback appoinment request")] [WebInvoke(UriTemplate = "InitiateContact", Method = Verbs.Post)] public string InitiateContact(AppointmentRqst rqst) {      string ret = string.Empty;      rqst.DeviceId = Helper.GetHttpAuthHdrDeviceId();      try      {          ret = impl.InitiateContact(rqst);      }      catch (Exception ex)      {          throw new WebFaultException<string>(ex.Message, HttpStatusCode.BadRequest);      }      return ret; }

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!!

returning from frame to main page

Hi,   I have a main page with some buttons on it.If the user clicks on a button, a frame is created in the center and a order (web)form is shown.At the end of the form, when the order is placed, I want to close the frame somehow. What would be the best way to do this? If I do a redirect on the page that is in the frame, it just opens the main page in the frame, which isn't what I'm looking for of course. rg,Eric 

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 sync main thread and new opened window

Hi all, I need to halt the main thread until some workflow is completed on the opened Window, the opened window has a user control content in which the user enter some data and click the button "next" . how can i halt the main thread and signal it to continue after the next button has been clicked? I've tryed using AutoRestEvent but the main thread get stucked and the window is frozen. ShowDialog wont help me, because i want to keep the window visible after the next button is clicked.     public void SomeMethod() { AppWizardStep2 step2 = new AppWizardStep2(ref myParams); Window myWin = new Window(); myWin.Content = step2; myWin.Show(); //Halt here // ...some logic that needs to continue after user workflow is completed on step2 user control }      

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?


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

TCPClient and Read not returning complete data unless I use thread.sleep


Hello experts, here is my code that I have a question on:

 Dim receivedbyte(1024) As Byte
        Dim myread As Integer = 0
        Dim myresponsesb As New StringBuilder()
            myread = myns.Read(receivedbyte, 0, receivedbyte.Length)
            myresponsesb.Append(System.Text.Encoding.UTF8.GetString(receivedbyte, 0, myread))

        Loop While (myns.DataAvailable)

In the above, myns is a networkstream that is initialized with a tcpclient that is communicating with a XMPP server. basically, iam getting back xml messages.

The issue with the above is that if I dont use thread.sleep(500), the complete data is not returned. Why is that? I have tried to use a streamreader instead of read and using that method i can get complete data from the stream. What am I doing wrong with the Read method of networkstream?

SECOND: The XML being returned from the server is not well formed - the closing tag for one of the tags is missing and I am unable to use XDocument to parse this XML because of this. What could be the issue here? Is it my code or something on server end?

Also, what technique should i use to make the returned XML well formed so that I can use XDOCUMENT and LINQ to parse this?


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,");
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