HA
haneefm
Syncfusion Team
April 30, 2007 03:29 PM UTC
Hi Klaus,
If you want to set row header names in the GridDataBoundGrid , you have to handle the PrepareViewStyleInfo Event of the grid. Please follow the code given below.
this.gridDataBoundGrid1.Model.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header";
// PrepareViewStyleInfoEvent
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex == 0 && e.RowIndex > 0 && this.gridDataBoundGrid1.DataSource != null)
{
e.Style.Enabled = true;
e.Style.CellType = "Header";
e.Style.Text = "ABC";
}
}
Best regards,
Haneef
RY
Rob Yang
February 13, 2008 08:11 PM UTC
Is there a way to resize the row header so that text set in this way isn't scrunched up ? I tried using Model.ColWidths.ResizeToFit() as per an earlier forum posting, but it didn't work. Thanks for any info !
HA
haneefm
Syncfusion Team
April 24, 2008 10:04 PM UTC
Hi Rob,
PrepareviewStyleInfo event does not store any styleInfo properties in a grid. It just set the visual apperence of the grid. ResizeToFit method resizes a range of rows or columns to optimally fit stored contents of the specified range of cells in grid. It depends on the data stored in a grid. If the Grid doesn't have any data, ResizeToFit method doesn't make any changes in a Grid.Here is a code snippet.
private void gridModel_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if(e.ColIndex == 0 && e.RowIndex > 0 && this.gridDataBoundGrid1.DataSource != null)
{
e.Style.Enabled = true;
e.Style.CellType = "Header";
e.Style.Text = "ABC";
}
}
Best regards,
Haneef