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. Image for the cookie policy date

GridDataBoundGrid row focus

hi, i am trying to let focus stay on one row i click on..as i am working on the contextmenu on the grid. i need to get the data of the current row so i would like focus on the row i selected.. but as data comes in the focus shift upwards ,the focus always stay on the same rowindex..i want it to stick to the row i selected.. thanks

7 Replies

AD Administrator Syncfusion Team May 25, 2006 11:09 AM UTC

Hi Pam, Try setting the SelectCellsMouseButtonsMask to excluded MouseButtons.Right to see if that helps. Below is a code snippet. this.gridDataBoundGrid1.Model.Options.SelectCellsMouseButtonsMask = this.gridDataBoundGrid1.Model.Options.SelectCellsMouseButtonsMask ^ MouseButtons.Right; Regards, Calvin.


XI xiaojie May 25, 2006 12:38 PM UTC

Hi Calvin: thanks for replying, but the code does''t work, i just want to be able to right click and then the context menu comes up and the row i selected always gets the focus... thanks


AD Administrator Syncfusion Team May 26, 2006 04:52 AM UTC

Hi Pam, Sorry, I am not able to understand the requirement clearly. Do you want the selected row not to change to the row where you have right clicked to pop up the context menu, or do you want to select the row where you have right clicked to pop up the context menu? The above code is for the first option. To select the row where you have right clicked set the SelectCellsMouseButtonsMask to include the MouseButtons.Right . Below is a code snippet. this.gridDataBoundGrid1.Model.Options.SelectCellsMouseButtonsMask |= MouseButtons.Right; Let us know if you are looking for something different. Regards, Calvin.


XI xiaojie May 26, 2006 08:48 AM UTC

Hi Calvin sorry for the confusion.. wut I want is the focus of the row in the grid stays as it is, the highlighted row will always be the row i clicked on, either right click or left click. as there are many messages coming in filling up the grid, and the row i selected will sink to the bottom or get outside of view, but I would like it still have the highlight.. so that when I bring up the contextmenu, the function does not pick up the wrong data just because the highlighted row is different.. thanks

grid11.zip


AD Administrator Syncfusion Team May 26, 2006 10:24 AM UTC

Hi Pam, Try setting the ListBoxSelectionMode to One to see if that helps. Below is a code snippet. this.gridDataBoundGrid1.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.One; Regards, Calvin.


XI xiaojie May 26, 2006 02:32 PM UTC

hi Calvin: i doesnt work.. are there other ways to freeze focus? thanks Pam


AD Administrator Syncfusion Team May 30, 2006 07:44 AM UTC

Hi Pam, Sorry for the delayed response. The selected current record can be set fixed in the selected potion when the grid is being populated, by setting the TopRowIndex property of the grid in the Binder.CurrentPositionChanged event handler. Sample attached. Let us know if this helps. Regards, Calvin.

44499.zip

Loader.
Live Chat Icon For mobile
Up arrow icon