Back to Devexpress

GridViewColumn.MaxWidth Property

aspnet-devexpress-dot-web-dot-gridviewcolumn-2134011d.md

latest2.9 KB
Original Source

GridViewColumn.MaxWidth Property

Gets or sets the maximum width of the column.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(0)]
public virtual int MaxWidth { get; set; }
vb
<DefaultValue(0)>
Public Overridable Property MaxWidth As Integer

Property Value

TypeDefaultDescription
Int320

The column’s maximum width.

|

Remarks

ASPxGridView allows you to resize columns in the UI or in code if the ASPxGridViewResizingSettings.ColumnResizeMode property is set to Control or NextColumn. To resize columns programmatically, use the Width property. You can also specify the MinWidth and MaxWidth properties to specify a range of acceptable width values for the column.

The MaxWidth property specifies the maximum width of an individual column. To specify the maximum width for all grid columns, use the ASPxGridViewSettings.ColumnMaxWidth property.

Note that the MaxWidth property is in effect if you use the fixed table layout in the grid.

Run Demo: Grid Columns - Resizing Columns

Run Demo: Responsive Layout

Concept

Example

aspx
<dx:GridViewCommandColumn ShowEditButton="true" Width="50px" />
<dx:GridViewDataTextColumn FieldName="OrderID" Caption="ID" Width="30px" />
<dx:GridViewDataTextColumn FieldName="ProductName" Width="35%" MinWidth="135" />
<dx:GridViewDataTextColumn FieldName="Price" Width="20%" MaxWidth="70" MinWidth="45" />
<dx:GridViewDataTextColumn FieldName="Quantity" Width="20%" MaxWidth="70" MinWidth="62" />
<dx:GridViewDataTextColumn FieldName="Total" Width="25%" MaxWidth="70" MinWidth="50" />
<dx:GridViewCommandColumn ShowDeleteButton="true" Width="50px" />

See Also

Grid View

GridViewColumn Class

GridViewColumn Members

DevExpress.Web Namespace