Badmiral
Badmiral

Reputation: 1589

Show and Hide Modal Popup Extender Not working

Hi all I have a modal popup extender set to a hidden linkbutton. So when I want to use it I am doing

protected void ProcessFileBtn_OnClick(object sender, EventArgs e)
{
    WaitModalPopupExtender.Show();
    //DO STUFF
    WaitModalPopupExtender.Hide();
}

Process takes a while, but no Modal Pop Up extender shows, when I create a button just to do the show function it works, but when I add in this

protected void Test_Click(object sender, EventArgs e)
{
    WaitModalPopupExtender.Show();
    System.Threading.Thread.Sleep(5000);
    WaitModalPopupExtender.Hide();

}

Nothing shows up. Any thoughts?

Upvotes: 1

Views: 3957

Answers (2)

Pushpendra
Pushpendra

Reputation: 810

It won't work. Why...?? First request sent to Server.

WaitModalPopupExtender.Show();----Executed---But no response send to Client
System.Threading.Thread.Sleep(5000);----Executed---But no response send to Client
WaitModalPopupExtender.Hide();----Executed---Now its time to send the response

Now you can expect the output that will be sent to the Client

Upvotes: 1

Dave Zych
Dave Zych

Reputation: 21887

Without seeing all of the code it's hard to tell, but I believe that the page is doing a PostBack when you click the linkbutton. When the page does a postback, it refreshes and therefore your ModalPopupExtender won't show. I think you're looking for and Ajax call to do what you want, which I'm pretty sure is showing a wait window while processing data.

Upvotes: 0

Related Questions