This is a migrated thread and some comments may be shown as answers.

Cell Align in RadGrid

1 Answer 440 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Red
Top achievements
Rank 1
Red asked on 26 Apr 2008, 07:05 AM
Hi
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

Sort by
0
Kiril
Telerik team
answered on 28 Apr 2008, 12:17 PM
Hello Red,

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:

radGridView1.MasterGridViewTemplate.Columns[

"City"].TextAlignment = ContentAlignment.MiddleCenter;

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:

http://www.telerik.com/support/videos/preview/b221i-cd-b221c-kcd.aspx
http://www.telerik.com/support/videos/preview/b221i-ce-b221c-kcd.aspx

I hope this helps. If you have additional questions, please contact me.

All the best,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Red
Top achievements
Rank 1
Answers by
Kiril
Telerik team
Share this question
or