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

selection change - off

Hi, I have a GridListControl with single selection mode. I need to lock selection change. Please Help.

8 Replies

AD Administrator Syncfusion Team January 24, 2006 02:31 PM UTC

Hi Dmitry, You can lock the selection change by using SelectionChanging Event handler in the GridListControl. Here is the code snippet. private void Grid_SelectionChanging(object sender, GridSelectionChangingEventArgs e) { e.Cancel = true; } private void gridControl1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer; this.gridControl1[3,3].ReadOnly = true; cr.ListControlPart.Grid.SelectionChanging +=new GridSelectionChangingEventHandler(Grid_SelectionChanging); } Refer to the sample for more details. GridListControl Let us know if you need further assistance, Regards, Madhan.


DG dmitry gilin January 24, 2006 02:49 PM UTC

>Hi Dmitry, > You can lock the selection change by using SelectionChanging Event handler in the GridListControl. Here is the code snippet. > > private void Grid_SelectionChanging(object sender, GridSelectionChangingEventArgs e) > { > e.Cancel = true; > } > private void gridControl1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e) > { > GridCurrentCell cc = this.gridControl1.CurrentCell; > GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer; > this.gridControl1[3,3].ReadOnly = true; > cr.ListControlPart.Grid.SelectionChanging +=new GridSelectionChangingEventHandler(Grid_SelectionChanging); > } > >Refer to the sample for more details. >GridListControl > >Let us know if you need further assistance, > >Regards, >Madhan. I do not need second cursor. How do I hide it?


ST stanleyj Syncfusion Team January 24, 2006 03:07 PM UTC

Hi Dmitry, Check if cc.EndEdit() in CurrentCellShowingDropDown event, solves for you. Thanks, Stanley


AD Administrator Syncfusion Team January 24, 2006 03:29 PM UTC

Sorry, my English is bad. See attachment.

picture.zip


ST stanleyj Syncfusion Team January 24, 2006 03:47 PM UTC

Hi Dmitry, Please try this. this.gridListControl1.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); GridCurrentCell cc; private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { cc = this.gridListControl1.Grid.CurrentCell; if(cc.HasCurrentCellAt(e.RowIndex)) { e.Style.Borders.Top = new GridBorder(GridBorderStyle.Standard); e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Standard); e.Style.Borders.Left = new GridBorder(GridBorderStyle.Standard); e.Style.Borders.Right = new GridBorder(GridBorderStyle.Standard); } } Best regards, Stanley


AD Administrator Syncfusion Team January 24, 2006 04:27 PM UTC

Thanks for quick your answers. Sorry again for my English. I have two GridListControls - Grid1(Master) and Grid2(Detail). I use SetDataBinding for binding with source(IBindingList). I need: if mode == Modes.Edit then 1. Cursor(SelectedItem) in Grid1 is fixed. 2. When I try change SelectedItem (mouse click) in Grid1, data in Grid2 be fixed to. if mode == Modes.View then Cursor in Grid1 is free. When I use your last variant I get one selected item. But if I click on other item my Grid2 has data change.


AD Administrator Syncfusion Team January 25, 2006 05:15 AM UTC

Help, please


AD Administrator Syncfusion Team January 25, 2006 06:34 AM UTC

Hi Dimtry, Setting this.gridListControl1.Enabled = false; will avoid the user from changing the selection, and again setting this.gridListControl1.Enabled = true; will allow the user to select. Regards, Calvin.

Loader.
Live Chat Icon For mobile
Up arrow icon