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.
Syncfusion Feedback

Activating first "Data" row when grid gets focus

Thread ID:

Created:

Updated:

Platform:

Replies:

8690 Nov 17,2003 01:22 PM UTC Nov 17,2003 02:04 PM UTC Windows Forms 2
loading
Tags: GridControl
Jeff Block
Asked On November 17, 2003 01:22 PM UTC

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

Administrator [Syncfusion]
Replied On 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?

Jeff Block
Replied On 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

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

;