The Engage Weblog


ASP.NET Ajax and DotNetNuke

By Brian Dukes on 2/5/2007

With the 1.0 release of ASP.NET AJAX, we have started integrating controls from the control toolkit into some of our DotNetNuke modules.  We've come across a couple of issues with the ModalPopup control in the (admittedly still Beta) AJAX control toolkit.

We've actually been using the ModalPopup for a while now in a couple of projects, and have been tracking an issue since around the Beta2 release.  In the DotNetNuke world, it seems, the ModalPopup was getting confused about the boundaries of the webpage, which ended up causing it to display mostly off the screen, in the upper left corner of the browser, making it unusable.  I had tracked down a solution on the ASP.NET forums, which unfortunately required recompiling the control toolkit.  It worked, but it wasn't a real pretty process to get there.

After upgrading to the 1.0 release, it looked like our troubles were through.  Without any changes, I was seeing the popup display in the middle of the screen, like it is supposed to.  However, when I passed my work off to an IE-using colleague, he started experiencing the problem himself.  After going back and forth for a while, we narrowed the issue down and found out that it worked in Firefox but not in Internet Explorer.  We started digging deeper into why IE was getting wrong values, and eventually, with the help of Jon Henning, found that IE was only giving different values depending on the doctype declared in the skin.  The default skin we had was using the HTML 4.01 doctype, but changing it to XHTML 1.0 Transitional fixed the problem for us, and allowed IE to see the proper bound of the browser window.

The just today we ran into another ModalPopup positioning issue.  We were working on integrating a popup into a website which is centered in the user's browser by means of div (styled left 50%, left-margin -300px with 600px of content).  When we tried to trigger the popup in this situation, the popup and grayed-out background were all shifted left, rather than centered.  We eventually just had to change the div into a centered table, which fixed the problem enough for us.  It seems that sites with "creative" positioning still might have issues getting the ModalPopup to display where they want it to.

Brian Dukes

Brian Dukes has been working with Engage professionally since 2006, but has been writing code since around 1998. Brian is very passionate about writing code that is easily maintainable, and helping others to do the same. He has been a leader in the DotNetNuke Community, and can often be found speaking at conferences and helping others on twitter, github, and stackoverflow. DNN recognized his community efforts by awarding him the DNN MVP in 2012. Outside of work, Brian spends time with his family, serves Jesus at City Lights Church, as well as supporting social justice, fair trade, local, seasonable food, and international adoption.