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
close icon

GridListControl and Selections

Hi,

I am using GridListControl. I want to enable/disable some buttons based on grid selection. Even though no row is selected, the Grid.Selections.Ranges.ActiveRange.IsEmpty is returning false. I am also explicitly setting List.SelectionIndex = -1, but of no use.
Pressing 'Esc' gives the expected behaviour. Please lte me know how I find whether selections is empty or not, and disable/enable the buttons accordingly.

Thanks in advance.

Regards
Kiran


6 Replies

AD Administrator Syncfusion Team March 19, 2007 06:02 PM UTC

Hi Kiran,

Try setting the SelectionMode property of the GridListControl to None to disable the selection andthen check the ActiveRange.IsEmpty property in grid. Please try this and let me know if this helps.

this.gridListControl1.SelectionMode = SelectionMode.None;
Console.WriteLine( this.gridListControl1.Grid.Model.SelectedRanges.ActiveRange.IsEmpty );

Best regards,
Haneef


AD Administrator Syncfusion Team March 20, 2007 02:51 PM UTC

Hi,

I want to enable/disable buttons based on grid selection chnages. If I set List.SelectMode to None then I will not be able to select any row. so List.SelectMode cannot be set to None. Is there any other way I can do that. Thanks.

Regards
Kiran


AD Administrator Syncfusion Team March 20, 2007 08:07 PM UTC

Hi Kiran,

Please try the attached sample and let me know if this helps.
GridList Control selection sample.

Best regards,
Haneef


AD Administrator Syncfusion Team March 21, 2007 05:13 AM UTC

Hi,

I don't want to enble disable selection in the grid. But based on selections in the grid I want to take some action. If no row is selected, I want to disable certain buttons, certain button should be enabled only if multiple selections are there. The problem is, even though no row is selected, ActiveRange.IsEmpty is false. Please let me know, how to find out if rows are empty in case of GridListControl. Thanks.

Regards
Kiran


KR Kiran Reddy March 27, 2007 11:51 AM UTC

Please provide solution for this. Thanks.

Regards
kiran


RA Rajagopal Syncfusion Team March 27, 2007 11:49 PM UTC

Hi Kiran,

Thanks for your patience.
You can use code like this to check for no rows selected in grid. You could add your code to enable/disable buttons accordingly.

if ( ! this.gridListControl1.Grid.Selections.Ranges.AnyRangeContains(GridRangeInfo.Empty) )
{
Console.WriteLine("No Rows Selected");
// code to disable buttons //
}
else
{
// code to enable buttons //
foreach (GridRangeInfo range in this.gridListControl1.Grid.Selections.GetSelectedRows(true, false))
{
for (int row = range.Top; row <= range.Bottom; ++row)
{
Console.WriteLine("Selected Row {0}", row);
}
}
}

Let us know if you need any further help.
Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon