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.
Unfortunately, activation email could not send to your email. Please try again.

How do I make the header in the GridDataBoundGrid invisible?

Thread ID:

Created:

Updated:

Platform:

Replies:

33514 Aug 22,2005 10:16 AM Aug 23,2005 06:37 AM Windows Forms 9
loading
Tags: GridControl
Atith Pagdi
Asked On August 22, 2005 10:16 AM

I''m using the GDBD to show some data to the user by binding it to a dataset. I need to set one of the column header''s property to invisible. How do I do this? Could someone give me the code snippet since I''ve tried finding an attribute to do this and have been unsuccessful so far. Thanks!

Administrator [Syncfusion]
Replied On August 22, 2005 10:32 AM

You can set the HeaderText property on the GridBoundColumn for the column to be one space (setting it to be teh empty string will not work). //if you haven''t added GridBoundColumns this.gridDataBoundGrid1.Binder.InternalColumns["Col1"].HeaderText = " "; //or if you added GidBoundColumns... this.gridDataBoundGrid1.GridBoundColumns["Col1"].HeaderText = " ";

Atith Pagdi
Replied On August 23, 2005 12:45 AM

I tried that Clay, but it still doesn''t work. There''s no change in the header text. This would however just make the text = "", but I want the column header itself to be invisible. How can we do this? I was trying the following code... GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex]; if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell) { if(style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.Name == "Product") e.Inner.Cancel = true; } but wasn''t able to find a reference to the GridTableCellStyleInfo class. Which namespace do I need to include for this class? (using...) Thanks.

Administrator [Syncfusion]
Replied On August 23, 2005 02:56 AM

Hi If your intension is to make the particular column header invisible , you can try the following code in the PrepareViewStyleInfo() event. if(e.ColIndex >= 1 && e.Style.CellType == GridTableCellType.ColumnHeaderCell.ToString()) { if(this.gridDataBoundGrid1.Model.NameToColIndex("Product") == e.ColIndex) e.Style.CellType = GridTableCellType.None.ToString(); } Regards Mouli.

Atith Pagdi
Replied On August 23, 2005 04:51 AM

Hi, I tried the code suggested by you, but the column header is still visible. I''ve been trying to do this for a couple of days now. Is there any other way we can handle this? Thanks, Atith

Atith Pagdi
Replied On August 23, 2005 05:08 AM

Also, on trying this... the NameToColIndex method returns the value 28 to me when there are no more than 10 columns in the grid. I have specified the layout of the datarow in the PrepareStyleInfo handler to be a multi row record. Do you think this could have anything to do with it? Thanks, Atith

Administrator [Syncfusion]
Replied On August 23, 2005 05:32 AM

You want to drawn an empty hole where the header cell is located, correct? Here is a sample using QueryCellStyleInfo. http://www.syncfusion.com/Support/user/uploads/GGC_EmptyHeaderCell_4558bc5b.zip

Atith Pagdi
Replied On August 23, 2005 05:44 AM

Clay, That''s for the GridGroupingControl. I''m trying to achieve this with the GridDataBoundGridControl.

Administrator [Syncfusion]
Replied On August 23, 2005 06:12 AM

The reason I thought you had changed to a GroupingGridControl is above you listed code like: GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex]; You use the model.QueryCellInfo event in a GridDataBoundGrid and do the same thing. http://www.syncfusion.com/Support/user/uploads/GGC_EmptyHeaderCell_dd519d5b.zip

Atith Pagdi
Replied On August 23, 2005 06:37 AM

Thanks Clay... your previouos suggestion, with some tuning did the trick for me. Thanks for your feedback. Regards, Atith

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.

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.

;