How can I set Alignment for Cell ?
In VS , I can set by change DefaultCellStyle , but I can't find the same for RadGrid
I want to display my table with Middle Center Aligntment.
Also, how can I set WrapMode For all Cells in RadGrid ?
Thanks so much
1 Answer, 1 is accepted
answered on 28 Apr 2008, 12:17 PM
Thank you for writing.
You can set the Alignment for cell content in two ways. If you would like to set an alignment for a specific column, find it in the columns collection (either by index or UniqueName), and from its ColumnInfo member, set the TextAlignment property as shown below:
Alternatively, you could set the TextAlignment property for all column by traversing the columns collection after databinding, as shown below:
foreach(GridViewColumn col in radGridView1.MasterGridViewTemplate.Columns)
col.TextAlignment = ContentAlignment.MiddleCenter;
If you would like to have the maximum degree of control over the TextAlignment, or any property related to visual appearance, please use the theming mechanism that comes with the RadGridView. You can open one of the standard themes in the Visual Style Builder and modify it to suit your needs.
You can learn how to use the Visual Style Builder from the two videos on our site: