_foregroundElement.ParentNode is null exception

OK, here’s the situation, my parents went away on a week’s vacation…

No, wait, that was from “Parents Just Don’t Understand”.

Back to the 21st century, I was messing around with a Panel property connected to a ModalPopupExtender controls from the Ajax toolkit. I was trying to hide the panel in code behind, but I was running across this exception at run time:

      _foregroundElement.ParentNode is null or not an object

It turns out that the problem was that I was hiding the Panel using the Visibility property:

     myPanel.Visibility = false;

When I changed the way it was displayed, using a style instead, it worked:

     myPanel.Attributes["display"] ="none";
  1. #1 by Haresh on June 7, 2012 - 9:16 pm

    It saved my life. Thanks a ton buddy

  2. #2 by Fabio on September 24, 2012 - 4:57 pm


  3. #3 by Luis G on November 21, 2012 - 12:21 pm


  4. #4 by Bill Farrell on December 13, 2012 - 4:56 pm

    Here it’s almost 2013 and this fix is the only one that works! You would think that Microsoft would have fixed these little nagging problems by now. But…

    Big Bill

  5. #5 by Hector on April 24, 2013 - 4:32 pm

    Thank you very much. You really saved my life!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: