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
me
<%@ 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.
'++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++++'
Try
'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())
Finally
'Ensure that the objects are disposed
oComm.Dispose()
oConn.Dispose()
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'")
else
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
BindGrid
End Sub

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

</script>

<html>
<head>
<title>Fill A DataGrid From Access Database</title>
</head>
<body>
<asp:DataGrid
ID="oGrid"
runat="server"
autogeneratecol umns="false"
OnItemDataBound ="dgEmployee_It emDataBound"
BorderColor="bl ack"
CellPadding="2"
CellSpacing="0"
Font-Size="10pt"
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"

HeaderStyle-Font-Bold="True"
FooterStyle-BackColor="#9B0 000"
FooterStyle-Font-Bold="True"
Headerstyle-BackColor="#9B0 000"
Headerstyle-Forecolor="#FFF FFF"
Headerstyle-Font-Name="Arial"
Headerstyle-Font-Size="11"
Font-Name="Arial"

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

<Columns>
<asp:templateco lumn headertext="#">
<itemtemplate > <span><%# Container.ItemI ndex+1 %></span>
</itemtemplate>
</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") %>'/>
</ItemTemplate>
</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" ) %>'/>
</ItemTemplate>
</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") %>'/>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
</body>
</html>
Mar 22 '06 #1
1 1311
You have no form tag. ASP Controls are required to be inside of single
form tag. As in
<body>
<form id="Form1" method="post" runat="server">
All your controls here.
</form>
</body>

Mar 22 '06 #2

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

Similar topics

2
9893
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
2
17769
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 ==========================================
3
2146
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...
8
10030
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'."
10
3496
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...
4
7309
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...
17
5114
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...
0
3476
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...
17
2661
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")
39
5896
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;
0
9961
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
9800
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,...
0
11182
Oralloy
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...
0
10778
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...
0
10439
tracyyun
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...
0
7148
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
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
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
2
4245
muto222
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.