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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl : Selection problem

Thread ID:

Created:

Updated:

Platform:

Replies:

75919 Aug 14,2008 02:38 PM UTC Aug 22,2008 10:59 AM UTC Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 14, 2008 02:38 PM UTC

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 ?







Sri Rajan [Syncfusion]
Replied On 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.



Administrator [Syncfusion]
Replied On 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 ?





Sri Rajan [Syncfusion]
Replied On 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.


Administrator [Syncfusion]
Replied On 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

Sri Rajan [Syncfusion]
Replied On 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.



CONFIRMATION

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.

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

;