Hello.

I am relatively new to ASP.NET and after having a good mess around myself I have come to a stand still.

I have a menu "web.sitemap", a master page "masterpage.master" and a content page "content.aspx". I would like to have my menu displayed on every page in my website so I have decided that I will put it on the master page. This menu requires a serverside form in order to work, so I have added it to a serverside form like below.

<asp:SiteMapDataSource id="nav" runat="server" />
<form runat="server">
<asp:Menu runat="server" DataSourceId="nav1" />
</form>

Now, each of my content pages (in this case "content.aspx") have their own serverside forms for their own duties.

This causes a conflict of interests, in that a webpage cannot have more than one serverside form. I can of course remove the form inside the content page and add the content placeholder inside the form of the master page as a quick fix but this does not solve the problem, i think.

Is there a solution to this problem? I would like to keep the serverside forms inside the content pages to carry out their duties if it is possible.

Thanks.

Recommended Answers

All 2 Replies

Just noticed that I have a slight typo in the code I posted. I wrote nav1 instead of nav, though this shouldn't really affect my question.

All I want to know is that.. a menu on a master page requires a serverside form, each of my content pages, require serverside forms. How can I have both? Is the only solution to make the serverside form in the master page or is there another way to get around this?

I appreciate any replies.

Cheers.

You only need a form in the MasterPage, atleast thats how i learned it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.