The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I'm using a GridDataBoundGrid and want to place the user on the first data row, if there is one. I am binding to a DataTable in a DataSet. I have successfully determined if there are rows or not, and actually have activated the first row as well, but I had to hard-code the cell to activate with the following line:
SelectionGrid.CurrentCell.Activate( SelectionGrid.Model.Rows.HeaderCount+1, SelectionGrid.Model.Cols.HeaderCount+1 );
I determined that the both HeaderCounts are always 0, even though there are column headers (top of columns), but no row headers (left side).
How do I determine at runtime how many rows are taken up at the top of the grid?
Jeff
ADAdministrator Syncfusion Team November 17, 2003 01:46 PM UTC
I would suggest using CurrentCell.MoveTo instead CurrentCell.Activate, but this change would not really affect your question on HeaderCount.
HeaderCount = 0 is the default setting when there is 1 row header (or one column header). When you set Cols.HeaderCount = 1, then you see 2 header rows. So, the HeaderCount is really the grid position of last header, starting from zero. Now, the HeaderCount will always be at least zero as the headers are always counted as present even if they are hidden. This is consistent with hidden rows not affecting RowCount as the rows are present, but just hidden.
So, I think your code using HeaderCount+1 should always pick out the proper first-nonheader-cell. Do you have a situation where this code does not pick out the proper cell?
JBJeff Block November 17, 2003 02:04 PM UTC
No...it just seemed that "count" would return the number of header rows, not the index of the last header row, but given your explanation I'll take it for what its worth and just add one to the counts.
In doing some more testing, if I turn off the headers all together with Grid.Properties.ColHeaders = false and Grid.Properties.RowHeaders = false, I still get 0 for both counts. But, CurrentCell.Activate( 1, 1) still activates the correct row (the first one). Seems odd, but...
Jeff