Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Export rows of Grid view to word in ASP.Net.I face flowing Error.

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



How to solve this problem?
Posted
Updated 13-Mar-14 19:16pm
v2

In .aspx page Wrap your gridview in this:


C#
 <form id="form1"  runat="server">
//gridview here
</form>
 
Share this answer
 
v2
Hey Bro,

You need to use <form> at starting of your Application i.e. <form> tag should be congaing the Grid.

Apply this at the starting of your application:-

<form id="form1" runat="server">


also don't forget to close this form at end of your Application.

Your code will look like this:

<form id="form1" runat="server">
<grid---->
----
----
---
</grid>
</form>
 
Share this answer
 
v3
C#
public override void VerifyRenderingInServerForm(Control control)
      {
          //required to avoid the runtime error "
          //Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."
      }
 
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