The suggested techniques are common and may be used not only for ASPxGridView, but for other controls also.
You can disable text wrapping in the following ways:
-
Set a column's CellStyle.Wrap property to
false.<dx:GridViewDataColumn FieldName="C1" Width="100" Caption='Wrap="False"'> <CellStyle Wrap="False" /> </dx:GridViewDataColumn>
-
Set the CSS
white-spaceproperty tonowrap..disableWrapping { white-space: nowrap; }
<dx:GridViewDataColumn FieldName="C2" Width="100" Caption='CSS nowrap'> <CellStyle CssClass="disableWrapping" /> </dx:GridViewDataColumn>
Note that when text wrapping is disabled, the column's Width property in not in effect.
You can enable text wrapping in the following ways:
-
Set the column's CellStyle.Wrap property to
true.<dx:GridViewDataColumn FieldName="C3" Width="100" Caption='Wrap="True"'> <CellStyle Wrap="True" /> </dx:GridViewDataColumn>
-
Set the CSS
white-spaceproperty tonormal..enableWrapping { white-space: normal; }
<dx:GridViewDataColumn FieldName="C4" Width="100" Caption='CSS normal'> <CellStyle CssClass="enableWrapping" /> </dx:GridViewDataColumn>
The previous approach works if cell text contains white spaces only. To wrap text that does not contain white spaces, use the CSS word-break property.
.wrapEmail {
word-break: break-all;
}<dx:GridViewDataColumn FieldName="C5" Width="100" Caption='CSS break-all'>
<CellStyle CssClass="wrapEmail" />
</dx:GridViewDataColumn>Set the GridDataColumnSettings.AllowEllipsisInText property to true to automatically truncate cell text if it does not fit into the cell's width. To indicate clipped text, the control displays an ellipsis (…).
<dx:GridViewDataColumn FieldName="C6" Width="100" Caption='Truncated text'>
<Settings AllowEllipsisInText="true" />
</dx:GridViewDataColumn>- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)
