0
votes

i drag a linkbutton into my masterpage and i try to run it , it says i should put a form tag runat = server , after i put it , it says that i can only have 1 form tag , but i check my materpage , don't have any form tag ..

<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Logout</asp:LinkButton>

My other pages have form tag of runat = server because when i try it , they told me to add it in , What have i done wrong and how should i correct it

My full master page : enter image description here

enter image description here

1
Do other pages use master page?tilda
yes other pages use master page toouser2376998

1 Answers

1
votes

Master pages are are also webforms, except that it will combine with content pages to form a single page at runtime. You'll need to put any server control inside <form runat="server"></form> . After you've made this, you don't need to add tags on other pages which is content page of this master page.

As of now, you can solve your problem by adding a

<form runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Logout</asp:LinkButton>
</form>

Put the ContentPlaceholder control inside the form tag

Remove <form> tag from content page