ComponentOne GridView for ASP.NET AJAX: GridView for ASP.NET AJAX Task-Based Help > Customizing the Grid's Appearance > Setting Column Width

Setting Column Width

This topic demonstrates how to set the width of a column in C1GridView.

A column's width can be specified in code if the column is not automatically generated. To set the column width:

1.   Set the AutoGenerateColumns property of C1GridView to False.

2.   Specify the columns to appear in C1GridView. See Hiding Specified Columns for more information.

3.   Set the width of the third column, for example, via the Code Editor or at design time:

      Add the following code after the DataBind method is called:

      Visual Basic

C1GridView1.Columns(2).ItemStyle.Width = New Unit(500)

      C#

C1GridView1.Columns[2].ItemStyle.Width = new Unit(500);

OR

      From the Property builder, select Format tab in the left pane and select a column from the list of Columns on the right. Change the Width property to 500 Pixels, and click OK.

 What You've Accomplished

In this topic you learned how to change the width of a column. In this example, the third column is 500 pixels:

 


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.