I am dynamically creating a datatable and a radgrid with autogenerated columns to display report information .
Some of the column headers are fairly long so I would like to increase the columns widths, I'm just not sure when the columns are generated. I tried changing them on ItemDataBound, it doesn't seem to recognize them.
Please help.
Aaron
Some of the column headers are fairly long so I would like to increase the columns widths, I'm just not sure when the columns are generated. I tried changing them on ItemDataBound, it doesn't seem to recognize them.
RadGrid gv = new RadGrid(); |
gv.ID = "tmpGrid"; |
gv.MasterTableView.HeaderStyle.VerticalAlign = VerticalAlign.Top; |
gv.MasterTableView.HeaderStyle.Width = Unit.Pixel(200); |
gv.ItemDataBound += new GridItemEventHandler(gv_ItemDataBound); |
gv.AutoGenerateColumns = true; |
gv.DataSource = master; |
PlaceHolder1.Controls.Add(gv); |
gv.DataBind(); |
void gv_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
foreach (GridColumn gc in e.Item.OwnerTableView.RenderColumns) |
{ |
gc.HeaderStyle.Width = Unit.Pixel(200); |
} |
} |
} |
Please help.
Aaron