I’ve noticed that in some of my developments using Ajax.Net the ModalPopupExtender flashes up breifly while some of the elements within the page finish loading. I have noticed this for browsers IE and Firefox, but not Chrome.
There is a very simple solution, you just have to remember to do it everytime you want to use a ModalPopup. Add the style=”display:none;” attribute to the asp:panel you are using as the extender, and this will ensure the ModalPopup remains invisible while the page loads.
Techie
.net, Bug, ModalPopupExtender, Quickies
The AJAX.Net ModalPopupExtender comes with the property ‘CancelControlID’, but what if you want to add multiple cancel controls, or trigger the Modal Popup to close based upon an event?
Simple, you can use the following javascript to fire the close event manually.
$find('ModalPopupExtender_Full_Control_ID').hide();
There, I said it was simple didn’t I?
Techie
.net, ajax, ModalPopupExtender, Quickies
When using the built in Modal Popup Extender for Ajax .Net, if you add any data or controls dynamically, you will notice that the Modal Popup has become unaligned or has breached it’s original size. Changing the size through CSS and Javascript is simple, however the position of the Modal Popup cannot be achieved in the same way.
To reposition the Modal Popup alignment, simply call the following function within your javascript. This will force the popup to recenter itself within the page.
$find('ModalPopupID')._layout();
Also, for people’s information, there are different properties for the automatic repositioning of the Modal Popup. These probably are never of use, unless you want to prevent the Modal Popup from realigning automatically.
Reposition Mode:
- None
- RepositionOnWindowResize
- RepositionOnWindowResizeAndScroll
- RepositionOnWindowScroll
Techie
.net, ajax, ModalPopupExtender, Quickies