Updatepanel height remaining largest size after update

After almost 4 years of use, one of my testers noticed something strange with my update panels.

Let's say I have a display mode and it takes 100 pixels in height. The user then switches to edit mode and the updatepanel updates. The window is now 500 pixels in height. The user clicks save and it turns back to display mode, which is only 100 pixels.

Now the dom only takes 100 pixels, but there still is a scrollbar all the way to 500 pixels. If the user shrinks the screen down to 100 pixels, he/she will still see a scrollbar, despite the fact that there's nothing down there anymore.

What the hell is causing this and how do I fix it? It's like the updatepanel doesn't tell the window it doesn't need all that height anymore.

13.10.2009 18:49:39
1 ОТВЕТ
РЕШЕНИЕ

Sounds to me like your control maybe using visibility="visible|hidden" instead of display:"none|block".

Use IE Dev Toolbar or Firebug to see what the DOM structure is during your page state.

It also may just be that your edit mode is too big for its fixed height container. Try not constrain the outermost container so it can grow with the dynamically changing internal content.

The visibility property determines whether a given element is visible or not (visibility="visible|hidden"). However, when visibility is set to hidden, the element being hidden still occupies its same place in the layout of the page.

CSS Properties: Display vs. Visibility

2
14.10.2009 22:44:50
That was pretty much it. We have a div that is set to visible during updates. This is an opaque div (absolute pos, z-order high) that takes the whole page and captures clicks so people can't do anything during a pageload. Somebody set the height of the div to the height of window.scrollwidth so it takes up the entire page via javascript. This hard number doesn't change. I had it take up 100% instead, which works just fine.
diadem 15.10.2009 20:18:25
Oh, and as you said, they set the visibility to hidden instead of none, despite the fact it had no reason to exist. It was just hard to track down because the dom element was modified programaticly in a js file.
diadem 15.10.2009 20:20:13