BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
Hi: I have tried several methods and reviewed your examples elsewhere in these forums but have been unsuccessful in hiding the header row. Please see the attached image and code files. What appears in the header are the mapping names for the data used to build the grid.
Separate note: The "drag files here" feature of this page does not allow text or jpg files. Makes it a bit clunky to share items.
Thanks
private void InitializeGrid()
{
this.Dock = DockStyle.Fill;
this.AutoGenerateColumns = false;
this.AllowEditing = true;
this.RowHeight = 200;
this.AutoSizeColumnsMode = AutoSizeColumnsMode.None;
this.SelectionMode = GridSelectionMode.Single;
this.NavigationMode = NavigationMode.Cell;
// Remove grid borders
this.Style.BorderStyle = BorderStyle.None;
this.Style.CellStyle.Borders.All = new GridBorder(GridBorderStyle.None);
this.Style.HeaderStyle.Borders.All = new GridBorder(GridBorderStyle.None);
// Enable column resizing - this is the correct property for WinForms SfDataGrid
this.AllowResizingColumns = true;
// Add scroll event handler
this.QueryRowHeight += OnQueryRowHeight;
// Turn off row headers
this.ShowRowHeader = false;
// Adjust size to fit within the parent panel
this.SizeChanged += (s, e) =>
{
if (this.Parent != null)
{
var parentPanel = this.Parent.Controls.OfType<Panel>().FirstOrDefault(p => p.Dock == DockStyle.Right);
if (parentPanel != null)
{
this.Width = this.Parent.ClientSize.Width - parentPanel.Width;
}
}
};
}
Hi Tom
Dennison,
Query |
Response |
|
Hi: I have tried several methods and reviewed your examples elsewhere in these forums but have been unsuccessful in hiding the header row. Please see the attached image and code files. What appears in the header are the mapping names for the data used to build the grid.
|
Based on the provided information, we understand that you need to hide the header row. This can be achieved by setting the SfDataGrid.HeaderRowHeight property to zero. Code Snippet:
|
|
Separate note: The "drag files here" feature of this page does not allow text or jpg files. Makes it a bit clunky to share items. |
We have created a
new forum for this query. Please follow up on the forum for further
updates. |
Regards,
Malini Selvarasu
Hi - Thank you for the response. I have replaced my existing code of:
this.ShowRowHeader = false;
With the suggested code of:
// Turn off row headers
this.ShowRowHeader = false;
Unfortunately the header row still appears.
Hi Tom Dennison,
Based on the information provided, we are a little unclear about whether you are trying to hide the RowHeader or ColumnHeader.
We have provided an
image of the RowHeader and ColumnHeader, along with details on how to hide
both headers.
Header |
Image |
Response |
RowHeader |
|
You can hide the Row Header by setting ShowRowHeader to false. Based on this, the Row Header will be hidden properly.
Code Snippet: this.sfDataGrid1.ShowRowHeader = false; |
HeaderRow |
|
You can hide the
HeaderRow by the SfDataGrid.HeaderRowHeight
property to zero. Code Snippet: this.sfDataGrid.HeaderRowHeight = 0; |
User Guide Documentation for Row Header: Rows
in WinForms DataGrid Control | Syncfusion®
User Guide Documentation for HeaderRow : Rows
in WinForms DataGrid Control | Syncfusion®
Please review the above solution and let us know if it resolve your issue,
thank you for your understanding.
Regards,
Malini Selvarasu
Hi: Sorry for the confusion. Yes, I am in fact trying to hide the header row. I have implemented the code to set the size to zero but the issue remains. I am doing this in initializeGrid which is called from the constructor. If you would like to see the entire section of code I can provide it. Do you have a secure method to upload it?
Attached is my code file. I will look at the sample you provided. Thanks!
I am not sure if the file uploaded so here it is again.
private void OnQueryRowHeight(object sender, QueryRowHeightEventArgs e) { if (e.RowIndex > 0) { if ((this.RowCount - e.RowIndex) < 5 && _imageCollection != null) { _imageCollection.LoadNextBatchIfNeeded(); } } if (e.RowIndex > 0) { e.Height = this.RowHeight; e.Handled = true; } } |
Hi: removing the e.Height = thisRowheight did the trick. I was unaware that setting the row height would also impact the header, especially if I had set it to zero.
Thank you for looking into this for me.