开发者

A page can have only one server-side Form tag

开发者 https://www.devze.com 2023-03-02 11:06 出处:网络
i added a page with html code to a master page and i got that mistake when i launched the page. i wonder what i did wrong!??!

i added a page with html code to a master page and i got that mistake when i launched the page. i wonder what i did wrong!??!

    <%@ Page Title="" Language="C#" MasterPageFile="~/YourGuruMaster.master" AutoEventWireup="true" CodeFile="YourGuru.aspx.cs" Inherits="YourGuru" %&g开发者_JAVA百科t;

    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <style type="text/css">
            .style3
            {
                width: 114px;
            }
        .style4
        {
            width: 293px;
        }
        .style5
        {
            width: 126px;
        }
        </style>
    </asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <form id="form1" runat="server">

      <div align="center">
        <p>
            <asp:TextBox ID="Question" runat="server" style="margin-left: 0px" Width="584px"></asp:TextBox>
        </p>
       </div>


    <div align="center">
        <table style="width: 553px">
             <tr>
                    <td class="style3">
                        <asp:Button ID="Ask" runat="server" Text="שאל" Width="50px" />     
                        </td>

                    <td class="style4">
                        <asp:DropDownList ID="DropDownList1" runat="server">
                        </asp:DropDownList>
                        &nbsp   &nbsp   &nbsp
                        <asp:DropDownList ID="DropDownList2" runat="server">
                        </asp:DropDownList>
                         &nbsp   &nbsp   &nbsp
                         <asp:DropDownList ID="DropDownList3" runat="server">
                          </asp:DropDownList>  
                       </td>

                        <td class="style5">
                            <asp:Button ID="Answer" runat="server" Text="ענה" Width="50px" />
                        </td>
                 </tr>
            </table>
    </div>


  </form>
</asp:Content>


ASP.NET Web Forms won't let you put more than one form tag in a page - your master page contains that form tag, so this:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<form id="form1" runat="server">
   <div align="center">

will cause problems as it's trying to add a form tag. You don't need this form here anyways as the form tag in your master page is quite adequate.


<head runat="server">
    <title></title>
</head>
<body style="direction:rtl;width:100%;background-color:#808080">
    <form id="frmLevel2" runat="server">
        <div dir="ltr" style="width:1000px;">
            <asp:Button ID="btnExit" runat="server" OnClick="btnExit_Click" Text="خروج" />
        </div>
        <div>
            <asp:GridView ID="GVLevel2" runat="server" Font-Names="Times New Roman" Font-Size="9pt" Width="700px" AllowPaging="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
                <AlternatingRowStyle BackColor="#F7F7F7" />
                <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                <SortedAscendingCellStyle BackColor="#F4F4FD" />
                <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
                <SortedDescendingCellStyle BackColor="#D8D8F0" />
                <SortedDescendingHeaderStyle BackColor="#3E3277" />
            </asp:GridView>
        </div>
        <div>
            <asp:Label ID="erorlabel" runat="server"></asp:Label>
            <asp:Label ID="lblresult" runat="server"></asp:Label>
        </div>
    </form>
</body>
</html>

My Error is " A page can have only one server-side Form tag. " too
i  don't have master page 
0

精彩评论

暂无评论...
验证码 换一张
取 消