gpt4 book ai didi

asp.net - 我如何获得 asp :Label to take up space before having text assigned

转载 作者:太空宇宙 更新时间:2023-11-04 15:35:46 25 4
gpt4 key购买 nike

我有 2 个按钮,它们需要位于表单的右侧,并且右侧有一个标签。我遇到的问题是,一旦执行了操作,标签将显示为“成功......”或“错误不能......”并且它搞砸了我的布局。当表单第一次出现时,它搞砸了我的按钮布局,因为标签是空的,然后当操作被执行时,我的标签被文本填充,然后将我的按钮推到正确的位置。有没有办法让我的按钮保持原位?

这是我的布局:

     <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="dropDownList" style="position: relative;" runat="server">
<label>
Select New File:
</label>
<asp:DropDownList runat="server" ID="ddlCaseFiles" DataSourceID="dsMyCaseFiles" DataTextField="Display"
DataValueField="FileID" OnPreRender="ddl_PreRender" Width="524px" OnSelectedIndexChanged="ddlCaseFiles_SelectedIndexChanged" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlCaseFiles"
ToolTip="Casefile Required" InitialValue="-1" Text="*" Display="Dynamic" />
<ajaxToolkit:ListSearchExtender ID="ddlExtCaseFiles" runat="server" PromptCssClass="ListSearchExtenderPrompt"
TargetControlID="ddlCaseFiles" BehaviorID="ddlExtCaseFiles" Enabled="True" />
<br />
/////////////////////////area of interest
<asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="position: relative;
float: left; margin-left: 450px;" OnClientClick="parent.$.fancybox.close();" />
<asp:Button ID="btnMoveCaseFile" runat="server" Text="" Style="position: relative;
float: right; margin-right: 63px; margin-left: -45px; top: 0px; left: 0px; width: 98px;"
OnClick="btnMoveCaseFile_Click" />
<asp:Label runat="server" ID="lblStatus"></asp:Label>
<br />
///////////////////////////////////////////////
</div>
</ContentTemplate>

我试图让按钮在下拉列表下亮起,并让标签显示在与按钮相同的行上,但在左侧。 (这段代码有换行的标签,因为我放弃了)

最佳答案

您可以在表格单元格中设置控件,并固定单元格的宽度。

注意:您可以使用 css class 修复宽度。

<table>
<tr>
<td>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="position: relative; float: left; margin-left: 450px;" OnClientClick="parent.$.fancybox.close();" />
</td>

<td>
<asp:Button ID="btnMoveCaseFile" runat="server" Text="" Style="position: relative; float: right; margin-right: 63px; margin-left: -45px; top: 0px; left: 0px; width: 98px;"
OnClick="btnMoveCaseFile_Click" />
</td>

<td>
<asp:Label runat="server" ID="lblStatus"></asp:Label>
</td>
</tr>

</table>

关于asp.net - 我如何获得 asp :Label to take up space before having text assigned,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12822463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com