Click here to Skip to main content
15,880,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,there
i am getting an error "A page can have only one server-side Form tag."
but my problem is ---
i need form runat=server in my master page and in webform also as it is screaming button(which is in master page) Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server. and i too need it in index.aspx as it tells Control 'ContentPlaceHolder1_ScriptManager1' of type 'ScriptManager' must be placed inside a form tag with runat=server. now what should i do in this case. plz help
Posted
Updated 8-Jan-14 2:40am
v2
Comments
Tejas Vaishnav 8-Jan-14 8:41am    
can you share your design code of master page and your content page like index.aspx or anything else from where you got the error.

for sharing code please use improve question functionality and update your question content.

Just don't put server-side form tag in your individual page, and then have your form tag at master page covering the content tag.

When you page renders, everything should fall within the form tags and you should be fine.

if any of your page need to post to another page, you can always use RegisterStartupScript() to emit javascript that set the form to different target.
 
Share this answer
 
When you use Master Page, it implements a form tag and inside that there is a ContentPlaceHolder which loads the Child Page.

So, no need to have another form tag specified for that Child Page. Of you look at the source of page after it is rendered in browser, you will get cleared about this concept.

You can see a simple HTML page with all the controls inside it, there is nothing Master or Child.
So, don't confuse yourself.

Keep coding. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900