Undead Lumberjack
New Member
Hi,<BR><BR>I had explaint this error last friday, but I hadn't put the code, so I'll do this time; The problem was that i'm trying to add a column to the left of my datagrid, the text of that column is "delete" so I can use it later with this command, But it don't work, because I can't even see the column added; instead I get the following error:<BR><BR>Server Error in '/' Application.<BR>--------------------------------------------------------------------------------<BR><BR>Parser Error <BR>Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. <BR><BR>Parser Error Message: The server tag is not well formed.<BR><BR>Source Error: <BR><BR><BR>Line 133:<!--Datagrid Code: --><BR>Line 134:<center><BR>Line 135:<ASP
ataGrid id="DBAddDataGrid" runat="server"<BR>Line 136: Width="100%"<BR>Line 137: BackColor="white" <BR> <BR>I think this must be a little problem of syntax, aniway I'm working with a standard html editor and not with vb.net ...<BR><BR>You can see here my entire code (admin interface to manipulate a mdb table):<BR><BR><%@ Page Language="VB" Debug="True"%><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><BR><script language="VB" runat="server"><BR> ' Declared outside the subs so both can access it.<BR> Dim objConnection As OleDbConnection<BR><BR> Sub Page_Load(Sender As Object, E As EventArgs) <BR> ' Set up our connection.<BR> objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("filess.mdb") & ";")<BR> If Not (IsPostBack)<BR> ShowDataGrid()<BR> End If<BR> ' Every call to the page adds a new record and<BR> ' shows the data in the table.<BR> End Sub<BR> <BR> Sub AddNewRecord(Sender As Object, E As EventArgs)<BR> Dim objCommand As OleDbCommand<BR> Dim strSQLQuery As String<BR> Dim miEnlace As String<BR> Dim Contra As String<BR> <BR> Contra="</a>"<BR> miEnlace="<a href=http://aspmessageboard.com/archive/index.php/"+""""+Enlace.value+""""+">"+NomFich.value+Contra<BR> <BR> ' Our insert command<BR> strSQLQuery = "INSERT INTO tbdownloads " _<BR> & "(NomFich, Enlace, DescF) " _<BR> & "VALUES (@TextValue, @IntValue, @DTValue)"<BR><BR> ' Create new command object passing it our SQL insert<BR> ' and telling it which connection to use.<BR> objCommand = New OleDbCommand(strSQLQuery, objConnection)<BR> <BR> ' Add parameters that our SQL command takes:<BR> objCommand.Parameters.Add(New OleDbParameter("@TextValue", OleDbType.VarChar, 255))<BR> objCommand.Parameters.Add(New OleDbParameter("@IntValue", OleDbType.VarChar, 255))<BR> objCommand.Parameters.Add(New OleDbParameter("@DTValue", OleDbType.VarChar, 255))<BR><BR> ' Set the values of these parameters:<BR> ' These can obviously come from anywhere... I'm just pulling<BR> ' in strings and numbers from the current time & date so<BR> ' I can keep the sample simple and not involve an input form.<BR> <BR> objCommand.Parameters("@TextValue").Value = NomFich.value<BR> objCommand.Parameters("@IntValue").Value = miEnlace<BR> objCommand.Parameters("@DTValue").Value = DescF.value<BR><BR> ' Open the connection, execute the command, and close the connection.<BR> objConnection.Open()<BR> objCommand.ExecuteNonQuery()<BR> objConnection.Close()<BR> <BR> ' Record is now added... you should add appropriate error<BR> ' checking and handling, but we've left it out simply for<BR> ' clarity and brevity. Either that or I was just too lazy<BR> ' to write it... I don't recall!
<BR> ShowDataGrid<BR> End Sub<BR><BR> Sub ShowDataGrid()<BR> Dim objCommand As OleDbCommand<BR> Dim strSQLQuery As String<BR><BR> ' Get all the records to show<BR> strSQLQuery = "SELECT Enlace, DescF FROM tbdownloads"<BR><BR> ' Create new command object passing it our SQL query<BR> ' and telling it which connection to use.<BR> objCommand = New OleDbCommand(strSQLQuery, objConnection)<BR><BR> ' Open the connection, execute the command, and close the connection.<BR> objConnection.Open()<BR><BR> DBAddDataGrid.DataSource = objCommand.ExecuteReader(System.Data.CommandBehavi or.CloseConnection)<BR> DBAddDataGrid.DataBind()<BR> objConnection.Close()<BR> End Sub<BR><BR></script><BR><BR><html><BR><body><BR> <form runat="server"><BR><BR> <h3><font face="Verdana"><u>Admin interface.</u></font></h3><BR><center><BR> <table width="95%"><BR> <td valign="top"><BR><BR> <table style="font: 8pt verdana"><BR> <tr><BR> <td colspan="2" bgcolor="#aaaadd" style="font:10pt verdana">Add new link to table:</td><BR> </tr><BR> <tr><BR> <td nowrap><b>Name of file: </b></td><BR> <td><input type="text" id="NomFich" value="Ej: Precios Nokia.pdf" runat="server"></td><BR> </tr><BR> <tr><BR> <td nowrap><b>Link: </b></td><BR> <td><input type=file id="Enlace" value="Doe" runat="server"></td><BR> </tr><BR> <tr nowrap><BR> <td><b>Description: </b></td><BR> <td><input type="text" id="DescF" value="Ej: Listado de precios Nokia, Febrero 2002." runat="server"></td><BR> </tr><BR> <td style="padding-top:15"><BR> <input type="submit" value="Add file" OnServerClick="AddNewRecord" runat="server"><BR> </td><BR> </tr><BR> <tr><BR> <td colspan="2" style="padding-top:15" align="center"><BR> <span id="Message" EnableViewState="false" style="font: arial 11pt;" runat="server"/><BR> </td><BR> </tr><BR> </table><BR><BR> </td><BR> </tr><BR> </table><BR></center><BR> </form><BR><!--Datagrid Code: --><BR><center><BR><ASP
ataGrid id="DBAddDataGrid" runat="server"<BR> Width="100%"<BR> BackColor="white" <BR> BorderColor="black"<BR> ShowFooter="false" <BR> CellPadding=3 <BR> CellSpacing="0"<BR> Font-Name="Verdana"<BR> Font-Size="8pt"<BR> Headerstyle-BackColor="lightblue"<BR> Headerstyle-Font-Size="10pt"<BR> Headerstyle-Font-Style="bold"<BR> MaintainState="false"<BR></HeaderStyle><BR> 'THE TROUBLE BEGINS HERE, WITHOUT THIS, THE CODE WORKS...<BR> <Columns><BR> <BR> <asp:ButtonColumn <BR> HeaderText="Delete Item" <BR> ButtonType="PushButton" <BR> Text="Delete" <BR> CommandName="Delete" /><BR> <BR> </Columns> <BR>'AND THE TROUBLE ENDS WITH THIS </COLUMS> TAG.. <BR>/><BR></center><BR></body><BR></html><BR><BR><BR>Any Ideas? I'm sure this is just a little error, but I can't debugg it.<BR><BR>Thanks a lot for your time!!<BR>From Spain.<BR>Salvador Gallego.<BR>Try This:<BR><BR><ASP
ataGrid id="DBAddDataGrid" runat="server" <BR> Width="100%" <BR> BackColor="white" <BR> BorderColor="black" <BR> ShowFooter="false" <BR> CellPadding=3 <BR> CellSpacing="0" <BR> Font-Name="Verdana" <BR> Font-Size="8pt" <BR> Headerstyle-BackColor="lightblue" <BR> Headerstyle-Font-Size="10pt" <BR> Headerstyle-Font-Style="bold" <BR> MaintainState="false" <BR>><BR><Columns> <BR><BR> <asp:ButtonColumn <BR> HeaderText="Delete Item" <BR> ButtonType="PushButton" <BR> Text="Delete" <BR> CommandName="Delete" /> <BR><BR> </Columns> <BR></ASP
ataGrid><BR><BR>Just had to rearrange some brackets
<BR><BR>])ryLike the Error Says: Your tags are not well formed. Looking at what you are trying to accomplish, the basic structure should be something like:<BR><BR><asp:dataGrid><BR>?<columns><BR>??<asp:itemTemplate><BR>???<asp:Button /><BR>??</asp:itemTemplate><BR>?</columns><BR></asp:dataGrid>Using MaintainState="false" I don't get the "server tag..." error yet, but I get this other one instead:<BR><BR>Server Error in '/' Application.<BR>--------------------------------------------------------------------------------<BR><BR>Control 'DBAddDataGrid__ctl2__ctl0' of type 'Button' must be placed inside a form tag with runat=server. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.Web.HttpException: Control 'DBAddDataGrid__ctl2__ctl0' of type 'Button' must be placed inside a form tag with runat=server.<BR><BR>Source Error: <BR><BR>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. <BR><BR>Stack Trace: <BR><BR><BR>[HttpException (0x80004005): Control 'DBAddDataGrid__ctl2__ctl0' of type 'Button' must be placed inside a form tag with runat=server.]<BR> System.Web.UI.Page.VerifyRenderingInServerForm(Con trol control) +151<BR> System.Web.UI.WebControls.Button.AddAttributesToRe nder(HtmlTextWriter writer) +38<BR> <BR>[etcetera...]<BR><BR>I'm starting to think this may be something relationated with web.config or something, because it seem to be an easy task but I can't do it :-(<BR><BR>Aniway thanks a lot ])ryWater and CristN,<BR><BR>Any other options?<BR><BR>Hope so... <BR>You don't gonna belive it, just putting the "</form>" tag under the datagrid code and deleting the "mantainstate=false" line, the code works also fluently...<BR><BR>Aniway there are two things I still not understanding:<BR><BR>A) Why the table doesn't show itself with the form load like happend before?<BR><BR>B) What is the Explanation for just change that tag and avoid the error? Something related with runat="server" tag, probably :S...<BR><BR>Thanks again.<BR><BR>Salvador Gallego.It was the Internet Explorer cache settigs the reason why it failed, so; 100% Solved :-D<BR><BR>Salvador Gallego.





