Tamaño ModalPopupExtender correctamente cuando lo muestra Client Script

In my ASP.NET Web Forms Page I have a ModalPopupExtender that is shown by JavaScript:

    // full ajax request shortened
    type: "POST",
    success: function (msg) {

    error: function (jqXHR, textStatus, errorThrown) {

It is neither centered nor sized the primer vez, but on subsequent calls it is fine (in Chrome, Firefox and IE9). I guess it has to do with a postback that is done on closing it (UpdatePanel partial update).

Now how can I trigger sizing by hand to get it to correct size the first time without using a server side call to Show? I tried calling initialize antes de que show, and I browsed through the client object's methods, but I have not found a solution yet.

Here are the styles that matched to the popup's div:

height: auto;    // matched css classes
width: auto;
max-height: 80%;
max-width: 90%;
min-width: 50%;
overflow: auto;
padding: 10px;
position: fixed; // element CSS
z-index: 100001;
left: 160.5px;
top: 157.5px;

preguntado el 28 de agosto de 12 a las 09:08

In all browsers? Can you show the css? When and how do you show it, can you show the complete js? -

Thank you, Tim. I added the bits you needed, and the browsers (Chrome, FF, IE9). -

1 Respuestas

I found workaround that makes the popup to appear correctly:


I agree there's a code smell in this. I could not find a better solution, however (I'm still open to suggestions). I especially dislike that _layout is invoked three times, once by myself and twice (in a row!) by show.

Respondido 28 ago 12, 11:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.