簡體   English   中英

Asp.net布局休息時未輸入必填字段(搞砸了我的布局)

[英]Asp.net layout breaks when required field isn't entered(screw up my layout)

我有一個問題,我的布局似乎很古怪,我不知道為什么。 這是我的布局:

<form id="form1" runat="server">
<input type="hidden" id="hidIsStrip" value="false" runat="server" />
<ajaxToolkit:ToolkitScriptManager ID="sm1" runat="server" EnablePageMethods="true" />
<div class="mainContentHolder">
    <h1>New IKS Server Credentials</h1>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <div id="rbfileByHolder" style="float:left; width:350px;" runat="server">
                <label>Sort By</label>
                <span><asp:RadioButton class="aspRBs" GroupName="rbfileByNameOrID" ID="rbMyFiles" Text="My Files"
                    runat="server" Checked="true" AutoPostBack="True" 
                    OnCheckedChanged="rbMyFiles_CheckedChanged" /></span>
                <span><asp:RadioButton class="aspRBs" GroupName="rbfileByNameOrID" id="rbByFileID"
                    Text="By File ID" runat="server" AutoPostBack="true"
                    oncheckedchanged="rbByFileID_CheckedChanged" /></span>
                <span><asp:RadioButton class="aspRBs" GroupName="rbfileByNameOrID" id="rbByFileName"
                    Text="By File Name" runat="server" AutoPostBack="true"
                    oncheckedchanged="rbByFileName_CheckedChanged" /></span>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <label>File</label>
            <asp:DropDownList runat="server" ID="ddlCaseFiles" DataSourceID="dsCaseFiles" 
                DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" 
                Height="20px" Width="400px" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="ddlCaseFiles" Display="Dynamic" ErrorMessage="*" 
                Title="Date Must Be Selected" />

            <br />
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="rbByFileName" EventName="CheckedChanged" />
            <asp:AsyncPostBackTrigger ControlID="rbByFileID" EventName="CheckedChanged" />
            <asp:AsyncPostBackTrigger ControlID="rbMyFiles" EventName="CheckedChanged" />
        </Triggers>
    </asp:UpdatePanel>
    <label>Date Active</label>
    <input type="text" class="datepicker halfsizedInputs" id="dateActive" runat="server" />
    <asp:RequiredFieldValidator ErrorMessage="*" ControlToValidate="dateActive" Display="Dynamic" runat="server" Title="Date Must Be Selected" />
    <asp:RegularExpressionValidator ErrorMessage="*" ControlToValidate="dateActive" display="Dynamic" runat="server" ValidationExpression="^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$" ToolTip="Date Format: YYYY/MM/DD" />
    <label class="inlineLbl">Length of Purchase</label>
    <input type="text" class="halfsizedInputs" id="txtLengthPurchase" runat="server" />
    <br />
    <label>Username</label>
    <input class="halfsizedInputs" type="text" id="txtUserName" runat="server" />
    <label class="inlineLbl">Password</label>
    <input class="halfsizedInputs" type="text" id="txtPassword" runat="server" />
    <br />
    <label>IP/Domain</label>
    <input class="halfsizedInputs" type="text" id="txtIPDomain" runat="server" />
    <label class="inlineLbl">Port</label>
    <input class="halfsizedInputs" type="text" id="txtPort" runat="server" />
    <br />
    <label>DES</label>
    <input type="text" id="txtDES" runat="server" style="width:430px;" />
    <br />
    <label>Location being used</label>
    <asp:DropDownList runat="server" style="margin-right:10px; width:400px;" ID="ddlLocationUsed" DataSourceID="dsIKSLocationTypes" DataTextField="LocationType" DataValueField="IKSLocationBeingUsedID" OnPreRender="ddl_PreRender" />
    <a style="width:15px;" class="lnkNewPopUpStyles" id="NewLocationUsedType">New</a>
    <br />
    <label>Website</label>
    <input class="halfsizedInputs" type="text" id="txtWebsite" runat="server" />
    <label class="inlineLbl">Task ID Purchased</label>
    <input class="halfsizedInputs" type="text" id="txtTaskIDPurchased" runat="server" />
    <br />
    <label>Amount Paid</label>
    <input class="halfsizedInputs" type="text" id="txtAmountPaid" runat="server" />
    <asp:RangeValidator class="validation" ErrorMessage="*" ControlToValidate="txtAmountPaid" Display="Dynamic" runat="server" MinimumValue="0.01" Title="Amount must be positive" MaximumValue="100000000" Type="Currency" />
    <label class="inlineLbl">Payment Method</label>
    <asp:DropDownList ID="ddlPaymentType" Width="157px" runat="server" DataSourceID="dsPaymentTypes" DataTextField="PaymentType" DataValueField="PaymentTypeID" OnPreRender="ddl_PreRender" class="halfsizedInputs" />        
    <br />
    <label>Comments</label>
    <asp:TextBox ID="txtComment" runat="server" Height="70px" MaxLength="250" TextMode="MultiLine" Width="435px"></asp:TextBox>
    <asp:RequiredFieldValidator ErrorMessage="*" ControlToValidate="txtComment" Display="Dynamic" runat="server" Title="Comments required" />
    <br />

    <asp:Button ID="saveCredentials" Style="float: right; margin-right: 25px;" runat="server" Text="Save New Credentials" OnClick="saveCredentials_Click" OnClientClick="return checkValidation();" />
        <input id="btnAddFilesToServerCredentials" style="float:right;" runat="server" type="button" value="Add Photos" />

    <br />
    <div>
        <label>Attached Files</label>
        <div id="attachedFiles" runat="server"></div>
    </div><br />
    <asp:Label ID="lblIKSMessages" runat="server" Font-Bold="True" ForeColor="DarkRed"></asp:Label><br />
    <input id="retvalA" runat="server" type="hidden" />
    <input id="retvalB" runat="server" type="hidden" />
</div>
<div id="newddlLocation" style="display:none;">
    <label class="inlineLbl">Location</label>        
    <input type="text" id="txtNewLocation" />
</div>
<asp:HiddenField ID="hidCaseFileID" runat="server" />
<asp:SqlDataSource ID="dsIKSLocationTypes" runat="server" ConnectionString="<%$ ConnectionStrings:OSCIDConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="p_Elements_GetIKSLocationTypes" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:SqlDataSource ID="dsCaseFilesReverse" runat="server" ConnectionString="<%$ ConnectionStrings:OSCIDConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="p_CaseFiles_ListActiveCaseFilesReverse" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:SqlDataSource ID="dsCaseFiles" runat="server" ConnectionString="<%$ ConnectionStrings:OSCIDConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="p_CaseFiles_ListActiveCaseFiles" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:SessionParameter Name="InvestigatorID" SessionField="InvestigatorID" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsPaymentTypes" runat="server" ConnectionString="<%$ ConnectionStrings:OSCIDConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="Select PaymentTypeID, PaymentType FROM ElementsPaymentTypes"></asp:SqlDataSource>
<asp:SqlDataSource ID="dsMyCaseFiles" runat="server" ConnectionString="<%$ ConnectionStrings:OSCIDConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="p_CaseFiles_ListActiveCaseFilesAssignedTo" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:SessionParameter Name="InvestigatorID" SessionField="InvestigatorID" />
        <asp:SessionParameter Name="AssignedTo" SessionField="InvestigatorID" />
    </SelectParameters>
</asp:SqlDataSource>
</form>

我遇到的問題是下拉列表旁邊的標簽“文件”不會顯示在與下拉列表相同的行上。 並且在必填字段被激活時。 紅色星形顯示在標簽“文件”和下拉列表之間,而不是在下拉列表之后。 當激活必填字段時,標簽“日期有效”也傾向於向上跳一行。 因此,它最終出現在下拉列表旁邊。 有什么建議么? 我嘗試過縮小列表。

好像只是在標簽修復所有內容之前添加<br />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM