简体   繁体   中英

ASP.NET Web application - Web form - HTML issue

I am using VS 2015 and created a web app. I have a default page and a Site.Master.

The input fields are defined inside a table and the Save button and message field is outside the table.

The save button is to the right of the table.

Why won't the Save button, message field and footer show below the table?

在此处输入图片说明

The Default page:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OUTParameterWithSp._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
     <h1>OUT  Parameter with Stored Procedure</h1>

    <div> 
         <table align="left">  
                <tr>  
                    <td>  
                           UserName:  
                    </td>  
                    <td>  
                           <asp:TextBox ID="UserNameTextBox" runat="server"></asp:TextBox>
                    </td> 
                </tr> 
                <tr>  
                    <td>  
                           Password:  
                    </td>  
                    <td>  
                          <asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password"></asp:TextBox>
                    </td> 
                </tr> 
                <tr>  
                    <td>  
                           Confirm Password: 
                    </td>  
                    <td>  
                           <asp:TextBox ID="ConfirmPasswordTextBox" runat="server" TextMode="Password"></asp:TextBox> 
                    </td> 
                </tr> 
                <tr>  
                    <td>  
                           Email: 
                    </td>  
                    <td>  
                           <asp:TextBox ID="EmailTextBox" runat="server"></asp:TextBox> 
                    </td> 
                </tr> 
                <tr>  
                    <td>  
                           Country: 
                    </td>  
                    <td>  
                           <asp:TextBox ID="CountryTextBox" runat="server"></asp:TextBox>
                    </td> 
                </tr> 
          </table>  

          <asp:Button ID="SaveButton" runat="server" Text="Save" class="btn btn-primary" onclick="SaveButton_Click" />

          <asp:Label ID="lblErrorMsg" style="color:Red; font-weight :bold" runat="server"></asp:Label>
      </div>  
</asp:Content>

The Site.Master page.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="OUTParameterWithSp.SiteMaster" %>

<!DOCTYPE html>

<html lang="en">
    <head runat="server">
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title><%: Page.Title %> - My ASP.NET OUT Parameter with Stored Procedure Application</title>

        <asp:PlaceHolder runat="server">
            <%: Scripts.Render("~/bundles/modernizr") %>
        </asp:PlaceHolder>

        <webopt:bundlereference runat="server" path="~/Content/css" />
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    </head>

    <body>
        <form runat="server">
            <asp:ScriptManager runat="server">
                <Scripts>
                    <asp:ScriptReference Name="MsAjaxBundle" />
                    <asp:ScriptReference Name="jquery" />
                    <asp:ScriptReference Name="bootstrap" />
                    <asp:ScriptReference Name="respond" />
                    <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
                    <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
                    <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
                    <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
                    <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
                    <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
                    <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
                    <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
                    <asp:ScriptReference Name="WebFormsBundle" />
                </Scripts>
            </asp:ScriptManager>

            <div class="navbar navbar-inverse navbar-fixed-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>

                        <a class="navbar-brand" runat="server" href="~/">Out Parameter With Stored Procedure</a>
                    </div>

                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a runat="server" href="~/About">About</a></li>
                            <li><a runat="server" href="~/Contact">Contact</a></li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="container body-content">
                <asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder>
                <hr />

                <footer>
                    <p>&copy; Dan C. - <%: DateTime.Now.Year %> - Out Parameter With Stored Procedure (using ASP.NET Web Forms, a panel control, OUT Parameter and Bootstrap)</p>
                </footer>
            </div>
        </form>
    </body>
</html>

尝试在结束</table>标记后放置HTML换行符<br/>

The problem here is that your <table> element has the attribute align set to left .

To fix, simply remove align="left" from your table element.

Note that the align attribute was deprecated (see MDN or the HTML 4.01 specification for more information).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM