ASP.NET Ajax - Popup Extender Panel getting visible ( flickering) for half a sec while loading the page
I am using Ajax control tool kit popup extender with Panel.
- While loading the page first time, a small flickering is coming up so that content of panel is displaying for a half sec.
This content panel should display while I am clicking button. not on page load.
Any help to avoi开发者_开发知识库d this flickering?
Thanks, Ka
The content of your popup control is rendered into the html of the page so you can open it with javascript without doing a postback. The content is then hidden during the initialisation of the javascript for the popup control after the page has displayed which is why you see the flicker.
The ways to fix this are:
- Add style="display: none" to the target control. This instructs the browser to hide the content which it can do when it reads the style attribute. Might still cause a bit of flicker.
- Set the target control visible attribute to be false on the server side then use an async postback to show the target control and popup. You'll need the popup and target control in an asp:UpdatePanel for this to work.
- Build the content of the popup control dynamically in javascript or load it from a webservice call after the page has loaded
Thanks
Keith
just place these lines in page load. where ever you want to show call modal popup show method.
ModalPopupExtender1.Hide();
pnlModelPopup.Style["display"] = "none";
精彩评论