Tuesday, April 14, 2009

Fixing Ajax Model Popup layout

There is a document type tag in our asp.net pages which we normally donot even consider as important by default VS2005 gererates this like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

The purpose of this tag is to obey a specific DTD for the document, simply use only valid tags in a valid hirarchy.
As i mentioned earlier VS2005 by default generates html 1.0, some time it is required to use more recent versions like html4.0 for more detail Why use HTML 4.0? .
so we change document type tag to this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



Now coming to the topic if one use a ModalPopup on a asp.net content page for example we have a master page

1- common.Master {with document type html 4.0}

2-default.aspx (content page inheriting common.master)



when one use modal popup the asp.net ajax control on default .aspx, you might face the issue that

the" pop up that was supposed to overlap the original page with fading effect on the original pge" appears on the
content area only i.e only covers the contenttemplate of mastermage.

in order to fix this issue just change the document type in master page back to html 1.0.

resource: http://forums.asp.net/t/1013301.aspx


No comments: