We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how can I set the row header text?

Thread ID:

Created:

Updated:

Platform:

Replies:

60191 Apr 30,2007 01:04 PM UTC Apr 24,2008 10:04 PM UTC WinForms 3
loading
Tags: GridControl
Klaus Thrien
Asked On April 30, 2007 01:04 PM UTC

On using a GridDataBoundGrid I can change the column header by property ColumnName. How do I change the row header?

haneefm [Syncfusion]
Replied On 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

Rob Yang
Replied On 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 !


haneefm [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;