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

Accessing rows when AutoGenerateColumns=true

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 1
Veteran
Morten asked on 29 May 2008, 02:21 PM
A grid is populated with data with changing column names; ie:
1) "Unit", "a", "b", "c", "User"
2) "Unit", "d", "e", "User"

To handle this the property "AutoGenerateColumns" is set to true.

For the columns a, b, c, d and e, I would like to have both the column header and the row values centered.

How (and where) do I access the columns in order to have the column header (HorisontalAign) and row values centered?


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 30 May 2008, 04:02 AM
Hi,

Try setting the HorizontalAlignment as shown below.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        RadGrid1.MasterTableView.ItemStyle.HorizontalAlign = HorizontalAlign.Center; 
        RadGrid1.MasterTableView.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; 
        RadGrid1.MasterTableView.AlternatingItemStyle.HorizontalAlign = HorizontalAlign.Center; 
    } 

Thanks
Shinu.
Tags
Grid
Asked by
Morten
Top achievements
Rank 1
Veteran
Answers by
Shinu
Top achievements
Rank 1
Share this question
or