How can i get the selected column ranges(If Multiple seletion happend through ctrl key)

Hi Friends,

I am trying to get selection rages of column. Actually i tried with the Selection Changed event handler. If column selection happened through mouse then it is giving selected range as correct for mine requirement. suppose i have selected multiple column by using ctrl key then Selection Changed event not giving whole range information. Selection Changed event giving only currently clicked column range information.

For example,

Assume that control having 5 columns(C1,C2..C5).Initially i select the C1 then i select C2 by pressing ctrl key. In this situation, Selection Changed event handler gives Finally clicked column ranges details only (C2) not C1. Suppose if multiple selection was happend through the mouse move means Selection Changed event handler gives all the selected column range information (C1:C2).

Mine Requirement is, How can i get Selected Column Ranges when selection happened by preesing ctrl key?

With Regards,
Boopathiraja.


1 Reply

NR Nirmal Raja Syncfusion Team July 21, 2010 05:15 AM UTC

Hi Boopathiraja,

Thank you for your interest in Syncfusion products.

Retrieving the selected range using the e.Range in the SelectionChanged event will produce only the active range of the grid, and it will not provide the whole list of selection range. When you select it through dragging then it will be a single range and when you select it through mouse click then it will take each column in to the selected range as a list. To retrieve the selected range list please get the range directly from the grid object instead of e.Range in the event.

Please refer the code below which illustrate to retrieve the selected range list:
void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
Console.WriteLine(gridControl2.Selections.Ranges.ToString());
}


Let me know if you have any queries.

Regards,
Nirmal

Loader.
Up arrow icon