473,800 Members | 3,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error "Control 'GridView' must be placed inside a form tag with runat=server"

4 New Member
Hi,
I've an asp.net .ascx form and a gridview on that form.I've placed that form on an .aspx. Now while I'm trying to import data from gridview to excel it is showing the error "Control 'GridView' must be placed inside a form tag with runat=server"

see my code:

Expand|Select|Wrap|Line Numbers
  1.  <form action="readdata.aspx" runat="server">
  2.         <table>
  3.             <tr>
  4.                 <td style="width: 100px">
  5.                     <asp:Label ID="lblSearchBy" runat="server" Text="Search by:"></asp:Label></td>
  6.                 <td style="width: 100px">
  7.                     <asp:DropDownList ID="cmbSheets" runat="server" DataSourceID="SqlDataSource1" DataTextField="ISSUEID" DataValueField="ISSUEID">
  8.                         <asp:ListItem Value="0">Students</asp:ListItem>
  9.                         <asp:ListItem Value="1">Mathematics</asp:ListItem>
  10.                         <asp:ListItem Value="2">Geography</asp:ListItem>
  11.                     </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MCWEBConnectionString2 %>"
  12.                         SelectCommand="SELECT [ISSUEID] FROM [MCISSUES]"></asp:SqlDataSource>
  13.                 </td>
  14.  
  15.                 <td>
  16.                     <asp:Button ID="btnSearch" runat="server" Text="Search" /></td>
  17.             </tr>
  18.         </table>
  19.         <br />
  20.      <asp:GridView ID="dgResults" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None">
  21.             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
  22.             <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
  23.             <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
  24.             <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
  25.             <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
  26.             <AlternatingRowStyle BackColor="White" />
  27.         </asp:GridView>
  28.         <asp:Button ID="btnToExcelByResponse" runat="server" Style="z-index: 100; left: 92px;
  29.             position: absolute; top: 393px" Text="Export to Excel using Response Object" />
  30.             </form>
Oct 17 '10 #1
0 1242

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3713
by: SASIKUMAR JP | last post by:
Hi, I have written simple code,which will accepts integer input.if i give character as input,it will not wait for user input next time.what is the problem in scanf or my code. Sample Code: #include <stdio.h> int main(){
1
995
by: sasikumar | last post by:
i can't run asp.net webpage in internet explorer unless i run project from visual studio 2005. how i run say title.aspx page in internet explorer without starting visual studio
1
4638
by: sasikumar | last post by:
i have created a new folder inside project(say update for storing update files for software) how can i get total number of files in that folder.what will be full path for accessing that folder.(path compatibile for use in system.io)
3
2410
by: sasikumar | last post by:
Can i hide page name (default.aspx) appearing in addressbar and status bar of internet explorer or firefox. if yes please tell me vb.net code for that.
3
1068
by: sasikumar | last post by:
hi, i want to send sms to mobile using asp.net.what can i do for that.
1
1253
by: ctsasikumar | last post by:
Hai Guys, Anybody knows How to refersh a sigle part in a page.i know meta refersh and heder rediect refersh.What want is whole page single part only refersh partiular time period..Please helme Thanks and Regards Sasikumar.T
2
1568
by: ctsasikumar | last post by:
Hello Guys, Now I am Using Python With Postgresql database.I read all place No need user name and password for Login Postgressql only database name is enough.But i tried select database this user don't have permission showing.anybody know user name and password of PyGreSQL Thanks and Regards Sasikumar.T
7
7625
by: sforsasi | last post by:
Hi, I'm trying a simple code to upload a file to the server. When I click to Upload I get the following error message: Error: Access to the path xxx is denied The folder in which I'm trying to upload the file has all access. I've included NETWORK SERVICE - with full control and ASPNET - with full control to the folder.
1
1326
Sasikumar B
by: Sasikumar B | last post by:
HI All, Please help me. I want to avoid someone deleting/replacing my mdb file kept on network. Our MDB Application file was used bye users in network so we cant avoid giving read /write access to users. Please help me with a solution. Thanks Sasikumar
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.