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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Questions on cells'' edit mode and change of the selection color of a whole row.

Thread ID:





98648 Mar 15,2011 08:18 AM UTC Apr 1,2011 11:46 AM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Asked On March 15, 2011 08:18 AM UTC

1)For grid control/data bound grid, How can I make the grid never have edit mode for the cell of certain columns while the whole row always being selected? E.g. there're 6 columns in a grid, and column 4, 5, 6 are read only and not editable, thus the cells of these column should not have the edit mode.

2)For these 2 types of grid, How can I change the select back color and select fore color when the whole row is selected?
Once I try to remove Alphablend from AllowSelection list(Because it can not provide me the conventional selection effect: blue background and white text ), it turns out the selection back color become black?

Replied On March 29, 2011 01:25 AM UTC

How to deactivate a cell's editing mode of a DataBoundGrid and always make the whole row being selected instead? and how to change the selection color of this row?
Many thanks.

Rajasekar [Syncfusion]
Replied On April 1, 2011 11:46 AM UTC

Hi Feng,

Thanks for using Syncfusion products.

Regarding Non-Editable Cell:

In GridDataControl,
you can make particular column as non-editable by setting ReadOnly property as True in the respective VisibleColumn of the DataGrid like shown below:

Code Snippet[XAML]

- - -
- - -

- - -
- - -

In GridControl, you can make particular column or cell or row as non-editable by setting ReadOnly property as True in the QueryCellInfo event of the datagrid like shown below:

Code Snippet[C#]

this.grid.QueryCellInfo += new GridQueryCellInfoEventHandler(grid_QueryCellInfo);

void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
if (e.Cell.ColumnIndex > 3)
e.Style.ReadOnly = true;

e.Style.CellValue = string.Format("Row{0}/Col{1}",e.Style.RowIndex,e.Cell.ColumnIndex);

Regarding Background and Foreground Color for Selected Rows:

In GridDataControl, you can achieve your requirement like shown below:

Code Snippet[C#]

this.dataGrid.HighlightSelectionBackground = Brushes.Blue;
this.dataGrid.HighlightSelectionForeground = Brushes.White;

In GridControl, you can achieve your requirement like shown below:

Code Snippet[C#]

this.grid.Model.Options.DrawSelectionOptions = GridDrawSelectionOptions.ReplaceBackground | GridDrawSelectionOptions.ReplaceTextColor;
this.grid.Model.Options.HighlightSelectionBackground = Brushes.Blue;
this.grid.Model.Options.HighlightSelectionForeground = Brushes.White;

For your reference we have also attached the sample herewith.

GridDataControl:< http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDC1640753944.zip >

GridControl:< http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GC1485855858.zip >

Please let us know if you have any queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon