在 ASP.NET Web 表单上保持 DevExpress 控件内联

发布于 2024-10-07 01:16:19 字数 769 浏览 1 评论 0原文

我刚刚用 DevExpress 控件替换了一个小型 Web 项目中的 Telerik 控件,但现在,尽管我添加了内联显示 div 作为容器,但这些控件不再内联呈现。可能是什么导致了这种情况,我该怎么做才能使这些错误的控件恢复内联?

<div style="display: inline;">
    <label>
        Department:</label>
    <dx:ASPxComboBox ID="deptCombo" runat="server" AutoPostBack="false" ValueField="DeptId" TextField="DeptName" Width="250px" OnSelectedIndexChanged="deptCombo_SelectedIndexChanged">
    </dx:ASPxComboBox>
    <label>
        Production Date:</label>
    <dx:ASPxDateEdit ID="productionDatePicker" runat="server" DisplayFormatString="{0:dd/MM/yyyy}" EditFormat="Custom" EditFormatString="dd/MM/yyyy" 
        ondatechanged="productionDatePicker_DateChanged">
    </dx:ASPxDateEdit>
</div>

I've just replaced Telerik controls in a small web project with DevExpress controls, but now, despite my adding an inline display div as container, these controls are no longer rendered inline. What could have caused this, and what can I do to get these errant controls back inline?

<div style="display: inline;">
    <label>
        Department:</label>
    <dx:ASPxComboBox ID="deptCombo" runat="server" AutoPostBack="false" ValueField="DeptId" TextField="DeptName" Width="250px" OnSelectedIndexChanged="deptCombo_SelectedIndexChanged">
    </dx:ASPxComboBox>
    <label>
        Production Date:</label>
    <dx:ASPxDateEdit ID="productionDatePicker" runat="server" DisplayFormatString="{0:dd/MM/yyyy}" EditFormat="Custom" EditFormatString="dd/MM/yyyy" 
        ondatechanged="productionDatePicker_DateChanged">
    </dx:ASPxDateEdit>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南烟 2024-10-14 01:16:19

听起来 DevX 控件有一些您需要覆盖的 CSS。

对于初学者,我会尝试将 !important 标志添加到样式中:

<div style="display: inline !important;">

如果这不起作用,请切换回 RadControls。他们要优越得多:)

Sounds like the DevX controls have some CSS that you'll need to override.

For starters, I'd try adding the !important flag to the style:

<div style="display: inline !important;">

If that doesn't work, switch back to the RadControls. They are far superior :)

一刻暧昧 2024-10-14 01:16:19

几乎所有 DevExpress 控件都呈现为表格。这种方法的主要优点是这种方法提供了良好的跨浏览器能力,因为当使用嵌套 div 时,可能很难在所有浏览器中同步它们的位置和大小。然而,使用表格可以让最终用户摆脱这个问题。

[CSS] 在您的 css 上添加此行

.DXControlsInline {display: inline-table;}

[ASPx] 在您想要内联的控件上添加 CssClass="DXControlsInline"

<dx:ASPxLabel ID="ckArboviralDiseaseChikungunyaOtherSpecify" runat="server"  CssClass="DXControlsInline" Text="Specify:"></dx:ASPxLabel>
<dx:ASPxTextBox ID="tbArboviralDiseaseChikungunyaOther" CssClass="DXControlsInline"  ClientInstanceName="tbArboviralDiseaseChikungunyaOther" runat="server" Width="350px"></dx:ASPxTextBox> 

来源: http://www.theedgesearch.com/2016/04/how-to-arrange-devexpress-controls.html

Almost all of DevExpress controls are rendered as tables. The main advantage of this approach is that this way provides good cross-browser capability, since when nested divs are used, it might be hard to synchronize their positions and sizes for all browsers. However, using tables allows end-users to get rid of this problem.

[CSS] add this line on your css

.DXControlsInline {display: inline-table;}

[ASPx] add CssClass="DXControlsInline" on controls you want to make inline

<dx:ASPxLabel ID="ckArboviralDiseaseChikungunyaOtherSpecify" runat="server"  CssClass="DXControlsInline" Text="Specify:"></dx:ASPxLabel>
<dx:ASPxTextBox ID="tbArboviralDiseaseChikungunyaOther" CssClass="DXControlsInline"  ClientInstanceName="tbArboviralDiseaseChikungunyaOther" runat="server" Width="350px"></dx:ASPxTextBox> 

Source : http://www.theedgesearch.com/2016/04/how-to-arrange-devexpress-controls.html

只是我以为 2024-10-14 01:16:19

该任务与我们的控件没有直接关系,并且可以在没有控件的情况下以类似的方式实现。对于 ASPxTextBox,请使用以下规则为其定义一个 CssClass 属性:

<dx:ASPxTextBox ID="txt1" runat="server" Width="170px" CssClass="txtStyle"></dx:ASPxTextBox>
.txtStyle {
    display: inline-block;
}

我准备了一个小示例来演示它的工作原理。另请参阅 CSS 显示属性。

更新:

当为 ASPxTextBox 指定标题时,它会呈现为表格。这就是为什么建议的方法在这种情况下不起作用。要解决此问题,我建议您将每个文本框放置在 div 元素中,并为其设置“display”属性。

The task is not directly related to our controls and can be implemented without them in a similar way. In the case of ASPxTextBox, define a CssClass property to it with the following rule:

<dx:ASPxTextBox ID="txt1" runat="server" Width="170px" CssClass="txtStyle"></dx:ASPxTextBox>
.txtStyle {
    display: inline-block;
}

I've prepared a small sample to demonstrate how it works. See also CSS display Property.

UPDATED:

When a caption is specified for ASPxTextBox, it is rendered as a table. That is why the suggested approach does not work in this case. To resolve this issue, I suggest you place each text box in a div element and set the 'display' property for it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文