简体   繁体   English

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

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

I have a problem my layout seems to be wack and I can't figure out why. 我有一个问题,我的布局似乎很古怪,我不知道为什么。 here is 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>

the problem I am having is the label "file" next to the dropdownlist won't show up on the same line as the dropdownlist. 我遇到的问题是下拉列表旁边的标签“文件”不会显示在与下拉列表相同的行上。 And when the requiredfield is activated. 并且在必填字段被激活时。 the red star shows up between the label "file" and the dropdownlist instead of after the dropdownlist. 红色星形显示在标签“文件”和下拉列表之间,而不是在下拉列表之后。 Also the label "Date Active" tends to jump up a line when the requiredfield is activated. 当激活必填字段时,标签“日期有效”也倾向于向上跳一行。 So it ends up next to the dropdownlist. 因此,它最终出现在下拉列表旁边。 Any suggestions? 有什么建议么? I've tried making the list smaller. 我尝试过缩小列表。

好像只是在标签修复所有内容之前添加<br />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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