Thursday, August 19, 2010

PopEndTag was called without a corresponding PushEndTag

I came across this error when overriding the menu class to make SharePoint navigation CSSFriendly. CSSFriendly control adapters from CodePlex are not an option, since control adapters change all navigation controls (horizontal and vertical) for all SharePoint sites and admin zones throughout the given application pool.

public class MossMenu:System.Web.UI.WebControls.Menu

Method to override:
- RenderBeginTag
- RenderContens
- RenderEndTag

After all errors removed and deploying solution, I get:
"PopEndTag was called without a corresponding PushEndTag"

Solution:
The solution is to add the render method so it mentions all methods:
protected override void Render(HtmlTextWriter writer)
{
  if (this.Page != null)
  {
    this.Page.VerifyRenderingInServerForm(this);
  }
  if (this.Items.Count > 0)
  {
    this.RenderBeginTag(writer);
    this.RenderContents(writer);
    this.RenderEndTag(writer);
  }
}

See solution at siderite blog
http://siderite.blogspot.com/2009/07/popendtag-was-called-without.html

No comments:

Post a Comment