1

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 ?

2 Answers 2

1

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.

4
  • yea, I've tried that but no luck. So you'd rather use a Web Site Project for that reason? Seems kinda like going backwards but who knows. Aug 4, 2009 at 13:08
  • problem is I can't regen that designer file. I have problems where my master page is no longer able to reference the user or custom controls in it no matter what I try. Aug 4, 2009 at 13:09
  • That's not the only reason I prefer website projects over web app projects - just one of many. I'd also check elsewhere in the project to make sure everything else builds. I feel your pain - i've spent a lot of time messing with broken designer files over the past 6 months. Still wish I knew how they manage to mess themselves up in the first place...
    – Scott Ivey
    Aug 4, 2009 at 14:08
  • @coffeeaddict Scott is correct, you need to do as he says. You have to debug the issues with why you can't convert to a WAP - I've spend days converting web site projects to WAPs. If you have questions I/stackoverflow can probably help you, but they are usually application-specific. Aug 4, 2009 at 20:33
0

The move to a WAP may have messed up the class for your master page.

Try adding a protected control decleration within your master page. In VB this is:

Protected WithEvents navBar as HtmlTableCell

I'm not totally sure this is correct, but it would be my first guess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.