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

Image in ggc header

Thread ID:

Created:

Updated:

Platform:

Replies:

71549 Feb 5,2008 03:48 PM UTC Feb 11,2008 04:27 AM UTC WinForms 5
loading
Tags: GridControl
harisan
Asked On February 5, 2008 03:48 PM UTC

Hello,

1. How could I show image or icon in ggc column header?
2. Why this code failed (no number on row header): ggc.TableModel.Options.NumberedRowHeaders = True

Best Regards,
Harry


Vinoth Kumar K [Syncfusion]
Replied On February 5, 2008 09:38 PM UTC

Hi Harry,

Thanks for using Syncfusion Products.

Issue #1: How could I show image or icon in GGC column header?

You can achive this by custom drawing your image in the TableControlCellDrawn event handler of the GridGroupingControl.


this.gridGroupingControl1.TableControlCellDrawn += new GridTableControlDrawCellEventHandler(gridGroupingControl1_TableControlCellDrawn);
private void gridGroupingControl1_TableControlCellDrawn(object sender, GridTableControlDrawCellEventArgs e)
{
if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
&& style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.Name == "Col3")
{
GridStaticCellRenderer.DrawImage(e.Inner.Graphics, this.imageList1, 0, e.Inner.Bounds, false);
}
}


Issue #2: How to set the Numbered row header.

GridGrouping control doesn't support NumberRowHeader property. One way you can include record numbers on the Row Headers of the Grid Grouping Control, by handling the QueryCellStyleInfo Event. The code below will help you to accomplish your task.


this.gridGroupingControl1.QueryCellStyleInfo +=new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.ColIndex == 0 && e.TableCellIdentity.RowIndex > 2)
{
e.Style.Enabled = true;
e.Style.Text = string.Format("{0}", e.TableCellIdentity.RowIndex - 3);
e.Style.Font.Bold = false;
}
}


Please refer to the sample given below which illustrates you how to set the image in header column and how to make the row header column numbered.

rel='nofollow' href="
http://websamples.syncfusion.com/samples/Grid.Windows/F71549_1/main.htm">http://websamples.syncfusion.com/samples/Grid.Windows/F71549_1/main.htm

Please let me know if you have any questions.

Regards,
Vinoth



harisan
Replied On February 7, 2008 04:13 AM UTC

Hello Vinoth,

Thanks it works well.
As for issue No.1:
How to put the image in particular row , e.g. Row("Qty") > 100 instead of Column header?

As for issue No.2: the text was truncated if number > 9.
How to adjust column width to auto resize?

3. How to adjust all ggc columns in parent & child tables to fill the ggc control's width?

4. I have ds.tables("Item") which have columns: Item_ID, Name, Qty, Price, Memo
'Name' and 'Mandatory' was set as 'Not Null' but didn't specified any default value.
How to enumerate through these columns and get info which column name was set as 'Not Null' (Mandatory)?
The code should be works for the other tables with different column settings.

Thanks and Best Regards,
Harry


Vinoth Kumar K [Syncfusion]
Replied On February 8, 2008 08:15 PM UTC

Hi Harry,

Thanks for using Syncfusion Products.

As for issue #1: How to put the image in particular row , e.g. Row("Qty") > 100 instead of Column header?

You can achieve this by using TableControlCellDrawn() event. Please refer to the sample given below which illustrates how to display image on a particular row based on certain condition

As for issue #2: Text is truncated if number greater than 9.

You can prevent text being truncated if the number greater than 9 by setting RowHeaderWidth. Please refer to the code snippet given below which illustrates how to prevent the text in header being truncated.


this.gridGroupingControl1.TableOptions.RowHeaderWidth = 35; //upto your need


Please refer to the sample given below which illustrates both the Issue1 and Issue2.

http://websamples.syncfusion.com/samples/Grid.Windows/F71549_2/main.htm

Regarding Issue #3: How to adjust all ggc columns in parent & child tables to fill the ggc control's width?

You need to resize the columns to fit over the grid's client area, by handling Grid.TableModel.QueryColWidth event as explained in this sample.

http://www.syncfusion.com/Support/user/uploads/GGC_Proportional_7b11b4f3.zip

Please refer to the Knowledge Base article in the below link:

How can I have my grid auto adjust column widths so that the columns completely fill the grid's client area
Helper class to support percentage sizing in GridControl/GridDataBoundGrid

Please let me know if you have any questions.

Regards,
Vinoth



harisan
Replied On February 9, 2008 04:10 AM UTC

Hello Vinoth,

As for issue #1: Would you attach a sample code in VB?

Issue #3: the GridColSizeHelper class didn't accept GridGroupingControl and got error msg: 'cannot be converted to GridControlBase'.
How to perfectly use this snippet with gridgroupcontrol?

Thanks and Best Regards,
Harry


Jeba S [Syncfusion]
Replied On February 11, 2008 04:27 AM UTC

Hi Harry,

The VB sample in the below KB article will help you to use a helper class in GridGroupingControl to
resize the columns to fit over the grid's client area.

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=489

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.



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

;