Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a master page which contains a general page framework and also
contains a form around most of the content of the page. Inside
that form tag is a ContentPlaceholder.

I then create an ASPX which is tied to that MasterPage and in it a put a
bunch of form fields and an asp:Button. When I try to run the page, I
get...

"Control 'ctl00_BodyCPH_ctl00' of type 'Button' must be placed inside a form
tag with runat=server"

So I tried outing a form inside the ASPX page as well and I got a different
error...

"A page can have only one server-side Form tag"
Posted
Comments
Akash Rangani 11-Dec-12 1:33am    
But When i Remove form tag from aspx page then other error display

"Control 'MainContent_dgEnquiry' of type 'GridView' must be placed inside a form tag with runat=server."

I am using below code
private string GridViewToHtml(GridView gv)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(sw);

dgEnquiry.RenderControl(hw);
return sb.ToString().Replace("<br />", "\n");
}
for get whole grid view data and want to send that data through Email
Hetal Jariwala 12-Dec-12 0:59am    
for each content place holder control in master page you need a content control check if it it properly done.

1 solution

Verify the ID of your Content Place Holder in master page and aspx page. It should be similar.
 
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