Skip to main content
Home Forums Silverlight Programming Programming with JavaScript Silverlight GetElementById IE6
3 replies. Latest Post by Jonathan Shen – MSFT on October 2, 2009.
(0)
Kohan
Member
0 points
2 Posts
09-24-2009 10:42 AM |
Hi, I have an odd error that you guys will hopefully be able to help me out with. I have this code in my silverlight app: private void MainGrid_SizeChanged(object sender, SizeChangedEventArgs e) { double acutalHeight = this.MainGrid.ActualHeight; HtmlPage.Document.GetElementById("silverlightControlHost").SetStyleAttribute("height", string.Format("{0}px", acutalHeight)); } which basically resizes my container div so that it fits in the browser. This is working fine in IE7+, Firefox and Chrome. The problem is that in IE6 this is not working, looking at the page which is generated and looking into the style created it seems that the div is not getting correctly targetted, instead a new style which looks like this is created: element.style { HEIGHT: 856px (This is the desired hight which should have been set to my DIV named "silverlightControlHost") } Does anyone have any ideas how i can get this working as desired? Thanks, Kohan.
Jonathan...
All-Star
24969 points
2,434 Posts
09-30-2009 4:35 AM |
Hi Kohan,
I have no IE6 environment now. You can set its min-height property and have a try. Please let me know the result.
Best regards,
Jonathan
10-01-2009 11:43 AM |
Thanks for the reply, However i believe IE6 ignores min-height; so this will have no effect. Cheers, Kohan
10-02-2009 3:15 AM |
min/max-height/width are not supported in IE6. To make it work, we need to do it like this.
selector {min-height:500px;height:auto !important;height:500px;}
or
div { height:500px; /* defaults to this if JS is disabled */height:BLOCKED EXPRESSION; }http://www.visibilityinherit.com/code/ie6-min-max-height-width.php
For your condition, we suggest you do this in a client javascript function and call it on code behind. Please let me know the result.