Bug in IE that changed Div. innerhtml

Source: Internet
Author: User
Today I encountered a bug about updatepanel.

Problem description:
Updatepanel contains several den controls. This updatepanel is refreshed every time a PostBack operation is performed.
The expected result is: Because updatepanel contains all the hidden controls, it should be hidden in any situation, and its height should be 0.
But the fact is:
1. When the page is opened through get for the first time, updatepanel is displayed normally, and the height is equal to 0.
2. when the updatepanel is updated using the POST method, a strange thing occurs. The height of the DIV corresponding to the updatepanel in the page is not equal to 0, and occupies the corresponding position in the page.

Find the reason:
At first, I thought I was myself.CodeProblem, So I repeatedly compared the content in innerhtml of every patial update to updatepanel Div, and found the same. Therefore, I suspected whether Microsoft Ajax was a problem. I set the breakpoint to sys $ webforms $ pagerequestmanager $ _ updatepanel in microsoftajaxwebforms. JS, and skipped the statement that changed updatepanelelement. innerhtml. Back to the page, the DIV height does not change, so the possibility of changing its height elsewhere is ruled out.

The current focus is on Div. innerhtml. Below I have tried two ways to verify:
1. Div. innerhtml = div. innerhtml content does not change
2. Div. innerhtml = "" Blank
The result is that each of them makes the height of the DIV not 0.

Conclusion:
I searched the internet and found that this is an IE bug. In the same case, neither Firefox, opera, nor Safari will change the DIV height.
In addition, the innerhtml attribute will not be changed, but this will happen when the child control in the DIV is added and deleted.

Solution:
My final solution is to use display: none in Div style to hide the div.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.