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 do I make the header in the GridDataBoundGrid invisible?

Thread ID:





33514 Aug 22,2005 02:16 PM UTC Aug 23,2005 10:37 AM UTC WinForms 9
Tags: GridControl
Atith Pagdi
Asked On August 22, 2005 02:16 PM UTC

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 02:32 PM UTC

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 04:45 AM UTC

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 06:56 AM UTC

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 08:51 AM UTC

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 09:08 AM UTC

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 09:32 AM UTC

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 09:44 AM UTC

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

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

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 10:37 AM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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