Last post Sep 22, 2007 09:55 AM by jim.dvorak
Sep 21, 2007 04:25 PM|jim.dvorak|LINK
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.
club web site navigation
Sep 21, 2007 04:35 PM|zowens|LINK
Do you have a runat="server" tag in your menu??
Sep 21, 2007 05:54 PM|jim.dvorak|LINK
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" />
Sep 21, 2007 09:06 PM|jim.dvorak|LINK
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:
<asp:Menu runat="server" ID="mnu1" DataSourceID="SiteMapDataSource1"></asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
Sep 22, 2007 09:46 AM|MaineOne|LINK
It needs to be in the Form tag. This is how it should look, it will need further formatting but it works.
Sep 22, 2007 09:55 AM|jim.dvorak|LINK
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.