Ajax Tip: Set position for ModalPopupExtender
Hi all, Ever wanted to set the location of the Modal windows you open using the ModalPopupExtender available when using ASP.NET Ajax toolkit?
Well there is a very simple way to do it using BLOCKED SCRIPT
1. Get the position you want the modal window to show. You can do it using ASP.NET Ajax library using Sys.UI.DomElement.getLocation method like this:
var location = Sys.UI.DomElement.getLocation($get("div1"));
In this case I used some div control to set the modal windows next to it.
2. Get the Modal window reference by using it’s panel or div element.
3. Set the location of the modal window:
Sys.UI.DomElement.setLocation($get(‘panel1’), location.x,
location.y);
Enjoy