IE8 and AjaxControlToolkit - Visibility bug

by filip 18. June 2008 17:08

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';
}

Tags: , ,

Web Development

Barack Obama's VP Choice: The best way to select Kathleen Sebelius

by filip 5. June 2008 20:46

Among popular candidates for vice president on the democratic party ticket is Kathleen Sebelius.  Selecting her, however, could prove problematic for Barack Obama. He certainly would not want to even further alienate Hillary Clinton's voters. Some could see it as another attack on Sen. Clinton, since she fought so hard for the nomination, and many think she deserves the vice president slot.

So how could Barack Obama put Gov. Sebelius on the ticket and win over Hillary's voters? If he chooses her, I really don't think he could say anything to make it up to the 18 million who voted for Hillary. Fortunately, there's another way. Sen. Obama could put Sen. Clinton in charge of selecting his VP, and if Hillary chose Kathleen Sebelius for the vice presidency, this could be seen as a win for both Barack Obama and Hillary Clinton.

  • Sen. Obama would have a very respected woman on the ticket, something millions of women want to see. Not to mention the whole Change theme... what else is a better signal for change than an African-American and a woman! I can't even imaging how Sen. McCain could even come close.
  • Hillary Clinton, in turn, would be seen as the reason why a woman made it to the ticket.  For a long time, she has been fighting for women - even though it is not her on the ticket, she could forever be remembered as the one who made it possible. 

I believe this choice could be very popular with Clinton's supporters, as long as it is handled properly. Hillary has fought long and hard for this - allow her to make this choice for Sen. Obama and both candidates win - and win big! That also leaves some room for both Clintons in Barack Obama's Cabinet - something I'm sure they are interested in.

Tags:

Politics

Using JavaScript methods in C#

by filip 4. June 2008 17:09

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.

Tags: ,

Web Development

About Filip Stanek

Death Note Pic I'm a developer at ACG in Cincinnati, OH. I like ASP.NET, Flash, and other web technologies, & enjoy playing chess, video games, etc.

Currently playing:

Disqus

Month List