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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridListControl and Selections

Thread ID:

Created:

Updated:

Platform:

Replies:

58119 Mar 19,2007 03:41 PM UTC Mar 27,2007 11:49 PM UTC WinForms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 19, 2007 03:41 PM UTC

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


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

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

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

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

Kiran Reddy
Replied On March 27, 2007 11:51 AM UTC

Please provide solution for this. Thanks.

Regards
kiran

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

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

;