Solved

Open and close modal popup based on conditions

Posted on 2013-12-14
5
596 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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