Asp – with id and runat=”server” not recognized in WAP

asp.net

I have the following line in my master page:

<td valign=top runat="server" id="navBar">

And then in the master page code behind we reference it and do something with it:

  public void HideNavbar()  
  {  
      navBar.Visible = false;  
      tdMain.Attributes["class"] = "MainWrapper";  
  }  

But for some reason when we copied this master page from a Web Site Project to a WAP project, it doesn't know what navBar is. It's not referencable in code-behind anymore.

Does the designer file need an entry for this? And what would that possibly be if I have an id in a ?

Best Answer

Another thing you could try is to delete the designer file, then right click on your master page and click on "Convert to Web Application." That will force a re-gen of the designer file, and pick up the new controls that have gotten out of sync with the designer file.

This specific issue is on my list of top reasons that I don't like Web Application Projects.