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

How do I remove the grid lines in the GridDataBoundGrid Control?

I''m using the GDBD to show some data and have multi row records in there. I''ve incorporated the following in my code to enable selection of the complete row whenever the user clicks on a cell that has some data: private void dgEx_CurrentCellActivating(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventArgs e) { e.ColIndex = 0; } But when the user clicks on an empty cell (some have been specified in the layout), only the single row gets selected. Is there anyway I can enable the selection of the complete row no matter which cell in the datarow record the user clicks? Thanks

3 Replies

AD Administrator Syncfusion Team August 22, 2005 02:33 PM UTC

Try setting grid.ListBoxSelectionMode = SelectionMode.One.


AP Atith Pagdi August 22, 2005 02:37 PM UTC

I already have done that... that''s why the whole row''s getting selected when I click on a cell that has SOME data in it. But when I click on an empty cell that has no data in it, the single row containing that cell is selected in some other colour, but not the whole datarow, the way it is in the previously stated case. Thanks >Try setting grid.ListBoxSelectionMode = SelectionMode.One.


AD Administrator Syncfusion Team August 22, 2005 03:15 PM UTC

I missed the multi-row part of your question. Try handing the grid.Model.SlectionChanged event, and there select the other row while a single row has been selected.
private void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
	if(e.Range.IsRows && e.Range.Height == 1)
	{
		int row = - 1;
		if(e.Range.Top % 2 == 0)
		{
			row = e.Range.Top + 1;
		}
		else
		{
			row = e.Range.Top - 1;
			
		}
		this.gridDataBoundGrid1.Selections.SelectRange(GridRangeInfo.Cells(row, 1, row, this.gridDataBoundGrid1.Model.ColCount), true);
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon