473,888 Members | 1,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server Error -- please help!

Hello Guys,

I am getting this error "
Control 'oGrid__ctl14__ ctl1' of type 'DataGridLinkBu tton' must be placed
inside a form tag with runat=server."
Here is my code and I don't know where it is doing it. Can some please help
<%@ Page language="VB" Debug="false" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<script language="VB" runat="server">

Sub Page_Load(Sende r as Object, E as EventArgs)
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapte r
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet
dim Pathdb as String
Pathdb = String.Format(s erver.mappath(" reports/db/specialk.mdb"))
'Build the connection string
'sConn = "Provider=Micro soft.Jet.OLEDB. 4.0;"
'sConn += "Data Source=" & server.mappath( "reports/db/specialk.mdb") & ";"
' sConn += "Persist Security Info=False"

'Build the SQL string sComm = "SELECT Products.Produc tID, "
'sComm += "Products.Produ ctName, "
'sComm += "Products.Produ ctDescription, "
'sComm += "Products.UnitP rice "
sComm += "Select LastName, FirstName, Phone FROM tblEmployeeChec klist
where ActiveStatus=Ye s order by lastname"' & "'"

'Usually you would use error-handling here. It is left out to
'make the code as simple as possible.
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
'Create the connection and command objects
oConn = GetMsAccessOled bConnection(Pat hdb, "admin", "")
'oConn = New OleDbConnection (sConn)

oComm = New OleDbDataAdapte r(sComm, oConn)
'Fill the dataset with the results of the query
oComm.Fill(oDat aSet, "Employees" )

'Set the grid source to the dataset and bind the data
oGrid.DataSourc e=oDataSet.Tabl es("Employees") .DefaultView
oGrid.DataBind( )
Catch ex As Exception
'if there is a database error, it will get caught here
oDataSet = Nothing
Response.Write ("An Error Occurred: " & ex.toString())
'Ensure that the objects are disposed
End Try
End Sub
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
public shared function GetMsAccessOled bConnection(ByV al dbPath As String,
ByVal dbID As String, ByVal dbPassword As String)
Dim dbConn As OleDbConnection
Dim dbConnStr As String =
String.Format(" Provider=Micros oft.Jet.OLEDB.4 .0;Data Source={0};User
ID={1};Password ={2}", dbPath, dbID, dbPassword)
return new OleDbConnection (dbConnStr)
End function
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
sub dgEmployee_Item DataBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs)
if e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then
e.Item.Attribut es.Add("onmouse over",
"this.style.bac kgroundColor='o range'")
End if
if e.Item.ItemType = ListItemType.It em Then
e.Item.Attribut es.Add("onmouse out",
"this.style.bac kgroundColor='B eige'")
else if e.Item.ItemType = ListItemType.he ader Or e.Item.ItemType =
ListItemType.fo oter Then
e.Item.Attribut es.Add("onmouse out",
"this.style.bac kgroundColor='# aaaadd'")
e.Item.Attribut es.Add("onmouse out",
"this.style.bac kgroundColor='B urlywood'")
End if
End sub
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
Sub oGrid_Page(send er As Object, e As DataGridPageCha ngedEventArgs)
oGrid.CurrentPa geIndex = e.NewPageIndex
End Sub

Sub BindGrid()
'oGrid.DataSour ce = oDataSet.Tables ("Employees").D efaultView
oGrid.DataBind( )
End Sub


<title>Fill A DataGrid From Access Database</title>
autogeneratecol umns="false"
OnItemDataBound ="dgEmployee_It emDataBound"
BorderColor="bl ack"
ForeColor="Blac k"
BackColor="Beig e"
ShowHeader="Tru e"
ShowFooter="Tru e"
AlternatingItem Style-ForeColor="Blac k"
AlternatingItem Style-Font-Name="Arial"
AlternatingItem Style-Font-bold="True"
AlternatingItem Style-BackColor="Burl ywood"
AlternatingItem Style-Font-Size="10"

FooterStyle-BackColor="#9B0 000"
Headerstyle-BackColor="#9B0 000"
Headerstyle-Forecolor="#FFF FFF"

AllowPaging="Tr ue"
PagerStyle-Mode="NumericPa ges"
PagerStyle-HorizontalAlign ="Right"
PagerStyle-NextPageText="N ext"
PagerStyle-PrevPageText="P rev"
OnPageIndexChan ged="oGrid_Page "

<asp:templateco lumn headertext="#">
<itemtemplate > <span><%# Container.ItemI ndex+1 %></span>
</asp:templatecol umn>
<asp:TemplateCo lumn HeaderText="Las t Name"
HeaderStyle-HorizontalAlign ="Center">
<ItemTemplate >
<asp:Label ID="lblLastName " runat="server"
Text='<%# DataBinder.Eval (Container.Data Item, "LastName") %>'/>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fir st Name"
HeaderStyle-HorizontalAlign ="Center">
<ItemTemplate >
<asp:Label ID="lblfirstNam e" runat="server"
Text='<%# DataBinder.Eval (Container.Data Item, "firstName" ) %>'/>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Pho ne#"
HeaderStyle-HorizontalAlign ="Center">
<ItemTemplate >
<asp:Label ID="lblPhone" runat="server"
Text='<%# DataBinder.Eval (Container.Data Item, "Phone") %>'/>
</asp:TemplateCol umn>
Mar 22 '06 #1
1 1311
You have no form tag. ASP Controls are required to be inside of single
form tag. As in
<form id="Form1" method="post" runat="server">
All your controls here.

Mar 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Dionísio Monteiro | last post by:
Hi there, After Installing IIS on a WinXP Pro machine, I have copied one of my web site files to test it on that machine. I have created a virtual directory, and when I try to access the site on http://localhost/website. When I try to load any ASP page, I get the following error: "Server Application Error The server has encountered an error while loading an application during the
by: Amanda | last post by:
From a guy in Microsoft newsgroups: | In *comp.databases.ibm-db2* there are always IBM guys | from the Toronto labs on line.Post with the | -for the love of god please help- | line and I'm sure you'll get their attention. | Their usually very good:) So here's my transplanted post ==========================================
by: David Walker | last post by:
Hi, I've encountered a problem when installing the .Net framework version 1.0 on a Windows 2000 Server machine in a clustered environment. After I install the framework and try to run a simple ASP.Net web page I receive the following message in my web browser: "Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser...
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
by: Ger | last post by:
I am having problems using VB.Net's Management base object on a machine hosting Windows Server 2003. I am trying to set file permissions from a Windows Service. These files may be loacted on a local machine or somewhere on the network. I use the Management Base Object to set these permissions which works perfectly when the windows service is running on an XP machine. However, when the service is running on a Windows Server 2003 machine I...
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always get the same error message: "An error occurred while creating one or more registry entries. Please see C:\WINDOWS\sqlstp.log for details. The problem could be caused by a low registry quota condition" I have tried to clean the registry and i...
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the Windows XP IIS back to ASP.NET 1.1 then I get the Configuration Error (which is understandable because I'm trying to run an ASP.NET 2 site with 1.1 framework). I can however view other ASP.NET 1.1 sites on my local Windows XP machine. It's only the...
by: anubhavbajpai | last post by:
In regards to the Server Application Error, One may perform the following steps : 1. Restart the IIS Default website. 2. Go to Start -> Run -> type cmd -> On the command prompt, type iisreset <computer name> <computer name> can be seen in "My Computer" Properties 3. Open Control Panel -> Administrative tools -> Computer Management -> Local user and groups -> Users open properties for IWAM_WP3CV970-CLM036 user a) check "Account...
by: Anil Gupte | last post by:
I am using the following to try to connect to the database, but it does not seem to be working. Dim sConnString sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MediaDB;Data Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString Dim Recordset Set Recordset=Server.CreateObject("ADODB.Recordset")
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
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...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.