Solved

Open and close modal popup based on conditions

Posted on 2013-12-14
5
557 Views
Last Modified: 2013-12-16
This is what I need:

if (condition == A)
       
     {
                 Open popup with a Please Wait message and a Close button
                 while ((line = sr.ReadLine()) != null)   // This loop takes about 10 minutes
                     {
                           Do Stuff
                           if (condition == B)
                                  {
                                         Change message in popup to "Finished"
                                  }
                     }   // End While
       } // End if (condition == A)

How can this be done?

Thanks,
0
Comment
Question by:Dovberman
5 Comments
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 200 total points
ID: 39720359
if (condition == A)
       
     {
                 Open popup with a Please Wait message and a Close button
//At this point your program will wait until a modal popup is closed
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 200 total points
ID: 39720384
Typically you would put the long job into a thread
0
 
LVL 16

Assisted Solution

by:hjgode
hjgode earned 100 total points
ID: 39720778
You have to show the popup in a separet thread. You can use the backgroundworker class to create a form in a background thread or you use your own new thread.

The backgroundworker calls provides members to call back into your main caode, so your main 'knows' that state (ie a progress or finish).

There are many examples out there, just search for "backgroundworker popup".

    public Form1()
    {
        InitializeComponent();

    }

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
       /* this.Invoke((Action)(() =>
                        {
                            var form2 = new Form2();
                            form2.Show();
                        }));  Winforms Method*/
         Dispatcher.Invoke((Action)(() =>
                        {
                            var form2 = new Form2();
                            form2.Show();
                        }));

    }

    private void Form1_Click(object sender, EventArgs e)
    {
        backgroundWorker1.RunWorkerAsync();
    }

Open in new window


In Form2 you would run your long file reading task.
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 200 total points
ID: 39720823
hi.. please go through this example

<styletype="text/css">
.noDisplay
{
display: none;
}
</style>

<divID="divModalPopup">
<cc1:ModalPopupExtenderID="ModalPopupExtender2"runat="server"
TargetControlID="dummy"
PopupControlID="Panel13"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OKButton">
</cc1:ModalPopupExtender>
<asp:LinkButtonrunat="server"ID="dummy"CssClass="noDisplay"Text="Click me..."/>
<asp:PanelID="Panel13"runat="server"CssClass="modalPopup"Style="display: none"Width="270px"BorderStyle="Double"ScrollBars="Auto">
<br/>
<tablestyle="width: 100%;"bgcolor="#79A9B9"cols="2"align="center"
cellpadding="2"cellspacing="2"border="2"bordercolor="olive">
<tr>
<tdalign="center">
<b>Attention User!</b>
</td>
</tr>
<tr>
<tdalign="center">
Your request has been submitted. Please make a note of the job information for your records.
</td>
</tr>
</table>
<br/>
<divalign="center">
<asp:ButtonID="OKButton"runat="server"Text="OK"/>
</div>
</asp:Panel>
<br/>
</div>
0
 

Author Closing Comment

by:Dovberman
ID: 39721540
Thank you.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now