JJ
Jisha Joy
Syncfusion Team
August 25, 2009 06:51 AM UTC
Hi Allon,
Thank you for posting query to us.
The desired behavior can be achieved by setting the ReadOnly property to true and handling the CurrentCellStartEditing event. See the code:
this.gridControl1.ReadOnly = true;
this.gridControl1.CurrentCellStartEditing += new CancelEventHandler(gridControl1_CurrentCellStartEditing);
void gridControl1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
e.Cancel = true;
}
Please let me know if this helps.
Regards,
Jisha
AL
Allon
August 25, 2009 11:13 AM UTC
Hi Jisha,
I'd like to thank you, for your quick reply, but I have one more thing to make it better. I'd like to know, how can I change background color of the selected row according to user selection with arrows (with something like grd.selectedrowindext). For now, I can change backcolor, only with grd_CellClick handler.
Thanks in advance
Allon
LS
Lingaraj S
Syncfusion Team
August 26, 2009 11:34 AM UTC
Hi Allon,
Thank you for the update.
If you want to select the row in GridControl, then please try using ListBoxSelectionMode property in GridControl to achieve this functionality.
Refer the code below:
#### C# code ####
this.gridControl1.ListBoxSelectionMode = SelectionMode.One;
// It is used to change the selection color
this.gridControl1.Model.Options.AlphaBlendSelectionColor = Color.Pink;
######## VB Code ###########
Me.gridControl1.ListBoxSelectionMode = SelectionMode.One
' It is used to change the selection color
Me.gridControl1.Model.Options.AlphaBlendSelectionColor = Color.Pink
GetSelectedRows method is used to get the selected row in GridControl.
Refer the code below:
#### C# code ####
GridRangeInfoList range = this.gridControl1.Model.Selections.GetSelectedRows(true, true);
MessageBox.Show(range[0].Top.ToString());
######## VB Code ###########
Dim range As GridRangeInfoList = Me.gridControl1.Model.Selections.GetSelectedRows(True, True)
MessageBox.Show(range(0).Top.ToString())
Please let me know if you have any queries.
Regards,
Lingaraj S.