updatepanel高度更新后剩余最大尺寸
使用近 4 年之后,我的一位测试人员注意到我的更新面板出现了一些奇怪的情况。
假设我有一个显示模式,它的高度为 100 像素。然后用户切换到编辑模式并且更新面板更新。窗口现在的高度为 500 像素。用户单击“保存”,它会返回到显示模式,只有 100 像素。
现在dom只需要100像素,但仍然有一个滚动条一直到500像素。如果用户将屏幕缩小到 100 像素,他/她仍然会看到一个滚动条,尽管事实上那里已经没有任何内容了。
到底是什么导致了这个问题,我该如何解决它?就像更新面板不会告诉窗口它不再需要所有的高度一样。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,您的控件可能使用visibility =“visible | hide”而不是display:“none | block”。
使用 IE 开发工具栏 或 Firebug 查看页面状态期间的 DOM 结构。
也可能是您的编辑模式对于其固定高度容器来说太大。尽量不要限制最外层的容器,以便它可以随着内部内容的动态变化而增长。
CSS 属性:显示与可见性
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.
CSS Properties: Display vs. Visibility