locked
Club Web Site Navigation RRS feed

  • Question

  • User2055147048 posted

    Hello, I want to remove the Repeater control that is used by default for the navigation and replace it with a Menu control.  However, when I do so, I get an error that says Menu control must be in a form tag with runat=server. So, then, why do I not get the same error on the repeater? Doesn't it have to be in a form tag with runat=server?

    How do I get the Menu control to work?

    Thanks in advance.

    Friday, September 21, 2007 4:25 PM

Answers

  • User2069888697 posted

    It needs to be in the Form tag.  This is how it should look, it will need further formatting but it works.

     

    <form id="form1" runat="server">
        <div id="navtop">
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
            <asp:Menu ID="TopNavMenu" Orientation=Horizontal runat="server" DataSourceID="SiteMapDataSource1">
            </asp:Menu>
        </div>
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            </asp:ContentPlaceHolder>
           <div id="navbottom">
           <asp:Menu ID="Menu1" Orientation=Horizontal runat="server" DataSourceID="SiteMapDataSource1">
           </asp:Menu>
        </div>
        </form>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 22, 2007 9:46 AM

All replies

  • User-1563988197 posted

    Do you have a runat="server" tag in your menu??

    Friday, September 21, 2007 4:35 PM
  • User2055147048 posted

    Yep.

    Basically, what I have tried so far is simply cutting the repeaters code out and putting it into notepad for safe keeping, then entering in Menu code:

    <asp:Menu runat="server" ID="Menu1" Orientation="Horizontal" DataSourceID="SiteMapDataSource1" />
    Maybe I'm missing something.
    Friday, September 21, 2007 5:54 PM
  • User2055147048 posted

    So, for kicks, I stuck a Label in the place of the repeater and it showed up just fine and greeted the world ("Hello, World!"). [:P]

    But, when I put a menu control in there, BOOM! "Control 'ctl00_mnu1' of type 'Menu' must be placed inside a form tag with runat=server." [:@]

    Here's what I got:

    <div id="navtop">
      <asp:Menu runat="server" ID="mnu1" DataSourceID="SiteMapDataSource1"></asp:Menu>
      <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
    </div>
     
    Friday, September 21, 2007 9:06 PM
  • User2069888697 posted

    It needs to be in the Form tag.  This is how it should look, it will need further formatting but it works.

     

    <form id="form1" runat="server">
        <div id="navtop">
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
            <asp:Menu ID="TopNavMenu" Orientation=Horizontal runat="server" DataSourceID="SiteMapDataSource1">
            </asp:Menu>
        </div>
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            </asp:ContentPlaceHolder>
           <div id="navbottom">
           <asp:Menu ID="Menu1" Orientation=Horizontal runat="server" DataSourceID="SiteMapDataSource1">
           </asp:Menu>
        </div>
        </form>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 22, 2007 9:46 AM
  • User2055147048 posted

    Hey, MaineOne.  Thanks.  I made these changes last night and it worked. But what I can't figure out is why some server controls, like Label or the Repeater, worked just fine in the implementation of default.master, but the Menu control did not.  Weird if you ask me.  I must be missing something.  Oh well.

    Thanks!

    Saturday, September 22, 2007 9:55 AM