简体   繁体   中英

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 />

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