IE8 and AjaxControlToolkit - Visibility bug

by Filip 6/18/2008 5:08:00 PM

Well, I finally downloaded IE8 to see how some of the sites I've worked on behave.  Most things work just fine, however, I did find a pretty significant problem with the AjaxControlToolkit.

I've been using the Tab control quite a bit, and I noticed that, when switching between tabs, the new tab was not showing up.  The old tab was hiding, though... 

Debugging has led me to the setVisible method located in "Common/Common.js" in the AjaxControlToolkit.  Specifically, the problem existed in the following code:

if (element && value != $common.getVisible(element))
{
  if (value) 
  {
    if (element.style.removeAttribute)
    {
      element.style.removeAttribute("display"
);
    }
    else

   
{
     
element.style.removeProperty(
"display"
);
   
}
 
}
 
else
 
{
    
element.style.display
= 'none'
;
 
}
 
element.style.visibility
= value ? 'visible' : 'hidden';
}

In the above code, removeAttribute() was being called, but the display attribute remained (display=none).  I looked up the removeAttribute method, and it does return a boolean value indicating if the method was successful or not.  Well, as it turns out, the method (for whatever reason) is not successul in IE8!

I'm not sure why this fails in IE8, but it does cause a problem.  Fortunately, there's a pretty quick fix to this:

if (element && value != $common.getVisible(element))
{
  if
(value) 
  {
    if
(element.style.removeAttribute)
    {
            if(!element.style.removeAttribute("display"))
            {
               element.style.display
= ''
;
            }

    }
   
else
   
{
     
element.style.removeProperty(
"display"
);
   
}
 
}
 
else
 
{
    
element.style.display
= 'none'
;
 
}
 
element.style.visibility
= value ? 'visible' : 'hidden';
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Web Development

Using JavaScript methods in C#

by Filip 6/4/2008 5:09:00 PM

I ran into a weird problem today.  I needed to escape a string in c# in such a way as to be able to unescape() it later with JavaScript into the original string.  JavaScript has an escape() method that is able to do this, but since I'm writing the code in C#, I can't really access that method.  At first, I looked into HttpServerUtility.UrlEncode() and the HttpServerUtility.HtmlEncode() methods, but those are not equivalent to JavaScript's escape() method. 

However, it seems Microsoft has put in a library which gives us access to JavaScript methods ( whether this is simply mimicking what JavaScript does or if it actually uses JavaScript... I could really care less).  All that was needed is a reference to Microsoft.JScript in the project, and I was able to call the Microsoft.JScript.GlobalObject.escape() method, and it produces the exact same output as the JavaScript version.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Web Development

Microsoft JScript runtime error: 'null' is null or not an object

by Filip 5/28/2008 3:44:00 PM

Programming JavaScript can be fun, but sometimes when I get errors like this it can get a little frustrating...

Microsoft JScript runtime error: 'null' is null or not an object

It happened on the following line, where the variable 'o' was null:

o.onmousedown = Drag.start;

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Web Development

Flash standalone installer for internet explorer (IE MSI)

by Filip 5/20/2008 4:14:00 PM

I'm not sure why Adobe makes it so hard to install the flash player with a MSI.  By going to adobe.com and clicking on the "Get Flash Player" link, it will direct you to a page that automatically will attempt to install Flash in IE.  I needed a MSI because I needed to install Flash on a machine with restricted internet access.  Fortunately, even though they don't advertise it, you can get a standalone installer for IE as well...

 http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_active_x.msi

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Web Development

'AjaxControlToolkit' is undefined (javascript)

by Filip 5/8/2008 4:14:00 PM

I got this annoying error recently in a website I've been working on.  It worked perfectly fine locally, it worked fine after uploading to the web server on my machine and other machines in the lab (various browsers).  Then, it turns out, it doesn't work on (one of) the client's machines.  Of course, I'm unable to replicate the error locally.

I looked around and it seems the first solution was to clear the cache.  A lot of people said that Ctrl+F5 works, others said they needed to manually clear the cache and then restart the browser.  Well, neither of those worked.

Fortunatelly, the solution turned out to be pretty easy:  Set the "CombineScripts" property of the ToolkitScriptManager to false.

 <ajaxToolkit:ToolkitScriptManager runat="server" ID="ajaxScriptManager" EnablePartialRendering="true" CombineScripts="false" />

Currently rated 4.6 by 5 people

  • Currently 4.64/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Web Development

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About Filip Stanek

Death Note Pic I'm a developer at ACG Multimedia in Cincinnati, OH. Besides working with ASP.NET, Flash, and other web technologies, I enjoy playing chess, Rockband, and keeping up with the recent events (US elections this year are actually fun!).
E-mail me Send mail


Recent comments