views:

1578

answers:

5

I have a modal popup that initially shows some content but expands a div if a checkbox is selected. The modal expands correctly but doesn't recenter unless you scroll up or down. Is there a javascript event I can tack on to my javascript function to recenter the entire modal?

A: 

Whatever event you have bound to the scrolling to get it to re-center, bind that event to the checkbox/div expanding event as well (or call it from within the other event). Hard to say more without seeing some code.

Adam Bellaire
A: 

The event is free from the Ajax Control Toolkit but I'm not sure what function it is calling. If I can find out what the function is I can easily wire it up when I show the div.

Luke
+1  A: 

Be careful that this isn't tied to the resize event of the window. If it is, your recentering could trigger a resize event in IE, which would cause an infinte loop.

If it is tied to the resize event, allow 1 or 2 resize events to occur, but then ignore the rest. (I say 2, because in IE, a "restore" event on the window will trigger at least 2 resize events (3 in IE6).

scunliffe
A: 

Hi Luke,

did you find a solution for your problem? Well I'm currently fighting with a similar problem.

Thx, Best Regards Andreas

+2  A: 

Here is what it is:

$find('ModalPopupExtenderClientID')._layout();

A real example from my page is:

$find('ctl00_rptAssignments_ctl03_btnShowGroupMembers_mpu')._layout();

Luke
Works well, thanks. I used the ClientID property in code to get the full client id.
Daniel Ballinger