I have a grid where ListBoxSelectionMode is set to SelectionMode.One;
The user can select any row greater then 3
private void Grid_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
if (e.Range.IsRows && e.Range.Top < 3)
{
e.Cancel = true;
}
}
private void Grid_CurrentCellMoving(object sender, GridCurrentCellMovingEventArgs e)
{
if (e.RowIndex < 3)
e.Cancel = true;
}
Everything ok so far.
Now the problem is that on row 2 there is 1 cell containing a combobox used for filtering the grid.
I cannot access that combobox because the 2 events prevents me from selecting it.
Is there workaround for this ?
SR
Sri Rajan
Syncfusion Team
August 18, 2008 10:49 AM UTC
Hi Gert,
Thank you for your interest in Syncfusion products.
You need to check whether celltype of the current cell is "ComboBox" before
setting e.Cancel as true in CurrentCellMoving event to solve this issue. Here is
the modified code.
void gridControl1_CurrentCellMoving(object sender,
GridCurrentCellMovingEventArgs e)
{
if (e.RowIndex < 3)
{
//You need to check whether current celltype is "ComboBox"
if(this.gridControl1.Model[e.RowIndex,e.ColIndex].CellType!="ComboBox")
e.Cancel = true;
}
}
void gridControl1_SelectionChanging(object sender,
GridSelectionChangingEventArgs e)
{
if (e.Range.IsRows && e.Range.Top < 3)
{
e.Cancel = true;
}
}
Please let me know if this helps.
Best Regards,
Srirajan.
AD
Administrator
Syncfusion Team
August 21, 2008 07:45 AM UTC
thx Srirajan for the quick reply.
That worked. 1 other issue :
I have set the property
Grid.ListBoxSelectionMode = SelectionMode.One;
But when the user selects the combobox in the header I don't want to higlight the entire header. Is it possible to avoid this ?
SR
Sri Rajan
Syncfusion Team
August 21, 2008 02:01 PM UTC
Hi Gert,
Thank you for your continued interest in Syncfusion products.
I am able to understand your requirements clearly from the given information. Can you please provide me some more information? or Is it possible for you to upload a minimal sample which explains this issue?. That will help us to analyze this issue further.
Please let me know if you have any further questions.
Best Regards,
Srirajan.
AD
Administrator
Syncfusion Team
August 21, 2008 02:42 PM UTC
Srirajan , i have uploaded a screenshot.
I hope it will show you what I want to retrieve.
screenshot_c0c7dd0d.zip
SR
Sri Rajan
Syncfusion Team
August 22, 2008 10:59 AM UTC
Hi Gert,
Thank you for your continued interest in Syncfusion products.
Please try this code to avoid selection of entire row when a combobox cell is selected in the header. The below code working for me. If you are again facing the same issue, Is it possible for you to upload a minimal sample which reproduces this issue?. That will help us to analyze this issue further.
void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
Console.WriteLine("Fire");
if (e.Range.IsRows && e.Range.Top < 3)
{
e.Cancel = true;
}
}
Please let me know if this helps.
Best Regards,
Srirajan.