Click here to Skip to main content
15,891,372 members

How to avoid error 'a page can have only one server-side Form tag'.?

hasbina asked:

Open original thread
Hi,

i have a usercontrol page as below

ASP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<div id="header" class="header">
   <h1 class="h1">TrackU: Student and Vehicle Tracking System</h1>
    <form runat="server" id="fomr2">
    <p class="p"><asp:LinkButton runat="server" ID="logBtn" ForeColor="White" Text="Logout"></asp:LinkButton></p>
    </form>
 </div>
 <div>
   <ul class="ul">
       <li class="li"><a class="lia" href="/Admin/Fleet.aspx">Fleet</a></li>
       <li class="li"><a class="lia" href="/Admin/StudentInfo.aspx">Student Info</a></li>
       <li class="li"><a class="lia" href="/Admin/RouteSettings.aspx">Route Settings</a></li>
       <li class="li"><a class="lia" href="/Admin/Reports.aspx">Reports</a></li>
   </ul>
 </div>




and the aspx page with usercontrol as below,

ASP
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fleet.aspx.cs" Inherits="M2iSTS2.Admin.Fleet11" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register src="~/UserControl/Header.ascx" TagName="Header" TagPrefix="UserControl" %>
<%@ Register src="~/UserControl/Footer.ascx" TagName="Footer" TagPrefix="UserControl" %>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" />  
   
</head>

<body>
    
    <UserControl:Header ID="Header"  runat="server"/> 
    <form id="form1" runat="server">
    
     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>  
   
<table border="1">
    <tr>
       <td style="width:250px;height:100%;background-color: #CEF">         
          
          <asp:UpdatePanel runat="server" ID="updatePanel1">
          <ContentTemplate>    
          <table align="center">
          <tr>             
              
              <tr>
                  <td>
                      <asp:ImageButton ID="vehiclelistBtn" runat="server" 
                          ImageUrl="~/image/vehiclelist_btn.png" onclick="vehiclelistBtn_Click" />
                  </td>
              </tr>
              <tr>
                  <td>
                      <asp:ImageButton ID="driverlistBtn" runat="server" 
                          ImageUrl="~/image/driver_list.png" onclick="driverlistBtn_Click" />
                  </td>
              </tr>
             
          </tr>
           </table>   
          </ContentTemplate>
          </asp:UpdatePanel>                    
         
       </td>
       <td style="width:100%;height:100%">       
       <div  id ="map_canvas" style="height:635px">
       
       </div>   
                    
       </td>
   </tr>
 </table>

 
    <UserControl:Footer ID="Footer1"  runat="server" />
    </form>
   
</body>
</html>


But it giving error as

A page can have only one server-side Form tag.

How to avoid this?

Thanks..
Tags: ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900