开发者

Keeping DevExpress controls inline on ASP.NET web forms

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" OnSelectedIndexChang开发者_StackOverflow社区ed="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>


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 :)


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


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. Let me know if this helps.

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜