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
close icon

Questions about DataBoundGrid

Hi, I have some questions about the data bound grid: 1. How can I allow users to drag columns? 2. We grid is configured to be read only, and the selection mode is selec only one row at a time. But still, when a row is selected, the cell which was clicked, is become "editable" and changes is layout like it''s ready to be edited. Since the grid is readonly, the content of the cell isn''t changed, but this cause a confusing behaviour. The cell appears as editable, but he is readonly. Can I change this behaviour? I want the cell remain as before selection, and not become editable when it''s clicked. 3. When the mouse cursor is above the grid lines a dragging rectangle graphic is added to the cursor, even though I didn''t clicked on any of the grid lines in order to drag a cell. Is there a way to disable this? Thanks a lot in advance, Sincerely, Gil K

1 Reply

AD Administrator Syncfusion Team June 16, 2004 06:40 AM UTC

1. Normally, all you need to do is to set properties to allow the user to select columns (AllowSelections property) and to allow the user to drag columns (AllowDragSelectedColumns property). But if you have set ListBoxSelectionMode to be anything other than None, this precludes selecting columns an dthus breaks moving columns. There are a couple of ways around this. If you are using SelectionMode.One, then you can use teh technique shouwn in the Grid\Samples\Quick Start\HighlightCurrentRow sample to highlight the row instead of setting the SelectionMode.One property value. This would allow you to set the other properties that would enable your user to move columns. Another work around that should work with any ListBoxSelectionMode setting is to also handle the CellClick. In the handler explicitly select the column if you click a header.
private void gridControl1_CellClick(object sender, GridCellClickEventArgs e)
{
	//use this code to try to handle column selections with ListBoxSelectionMode set
	if(e.ColIndex > 0 && e.RowIndex == 0)
	{
		this.gridControl1.Selections.Add(GridRangeInfo.Col(e.ColIndex));
	}
}
2. Try setting grid.ActivateCurrentCellBehavior = GridCellActivateAction.None; If you do not want the clicked cell to look differently, try also setting grid.TableStyle.Enabled = false; 3. In the grid''s ControllerOptions property, turn off the OleDataSource flag.

Loader.
Live Chat Icon For mobile
Up arrow icon