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

Row Selection in GridDataBoundGrid

I''d like to set up the grid to allow only single Row selection. When the selection changes I''d like to update a details section of the screen. I''ve got an event handler on grid.Model.SelectionChanged, and I''ve set the AllowSelection on the grid to only Row and AlphaBlend. The problem is that the selected row never changes, even though another row is visually selected. The triangle pointer in the row column never changes from the first row. How can I get my desired behaviour and what event should I be listening to? Thanks, Daws

3 Replies

Administrator April 27, 2004 06:16 PM UTC

Hi Daws, instead of changing AllowSelection try setting grid.Options.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.One; I think that is the behavior you are looking for. You can then check for CurrentCellMoved and CurrentCellActivated events. These events are raised when the current cell is moved. In the event handlers you can check whether the cell was moved to a new row and if that is the case then update your details information in the form. Stefan

DA Daws April 27, 2004 06:46 PM UTC

Thanks, that worked. One more minor detail. Is there a way to hide the Selected row arrow that appears in the Row header? The correct row gets highlighted, but the row selection arrow always stays on the first row. Thanks, Daws

Administrator April 27, 2004 08:23 PM UTC

That''s odd. The selection arrow should be moving together with the slected row. You are using a databound grid, correct? Anyway, if you do not want any arrow to appear you can change this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header"; Stefan
Loader.
Live Chat Icon For mobile
Up arrow icon