ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
Go Back  Xtreme Visual Basic Talk > > > ASP.Net runat=server error when adding button to form


Reply
 
Thread Tools Display Modes
  #1  
Old 09-18-2006, 05:31 AM
VBISCOOL2 VBISCOOL2 is offline
Regular
 
Join Date: Sep 2006
Posts: 51
Post ASP.Net runat=server error when adding button to form


Hello, I'm a bit new to ASP.Net. I have added a button (btnDelete) to my web form but when I try to run it I get the following error:







==========================================================

Server Error in Application.
--------------------------------------------------------------------------------

Control 'btnDelete' of type 'Button' must be placed inside a form tag with runat=server.
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.

Exception Details: System.Web.HttpException: Control 'btnDelete' of type 'Button' must be placed inside a form tag with runat=server.

=========================================================





Here is my HTML :

HTML Code:
[INDENT]<%@ Page  EnableSessionState="false" EnableViewState="false" Language="VB" Src="index.aspx.vb" Inherits="IndexPg" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Address Stop List Tool</title>
           <link href="web.css" rel="stylesheet" type="text/css" />
              <script language="javascript" type="text/javascript">
                    // <!CDATA[
                    function RefNo_onclick() {}
                    // ]]>
              </script>
    </head>
    <body>
        <div class="main" style="height: 211px" id="DIV1" onclick="return DIV1_onclick()">
        <img src="images/logo.gif" alt="Address Stop Tool" id="IMG1" onclick="return IMG1_onclick()" />&nbsp;<br />
           <form id="index" method="post" runat = "server" >
                <p>
                    <asp:Button id="btnDelete" runat="server" Text="Delete"/>
                </p>
           </form>
                <br />
                 <br />
               <asp: placeholder id="pcontent" runat="server"/>
                <br />
                <br />
                <br />
            <p align="left"><a href="http://lowellnet/">Return to Intranet Home Page</a></p>
         </div>
    </body>
</html>[/INDENT]
Thanks for any help.

Last edited by VBISCOOL2; 09-18-2006 at 06:12 AM.
Reply With Quote
  #2  
Old 09-18-2006, 08:34 AM
wayneph's Avatar
waynephASP.Net runat=server error when adding button to form wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

btnDelete looks ok, but the placeholder control should also be inside of the <form> tags as well. Anything that is a server control has to be inside a Server Form.

Since it looks like you're using Code Behind forms (.aspx.vb files) have you recompiled your app since you started getting this message.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
 
ASP.Net runat=server error when adding button to form
ASP.Net runat=server error when adding button to form
 
-->