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

GridListControl - Select Multiple Cells

Hi

I have a GridListControl. I would like to allow selections of multiple cells (not columns or rows)


10 Replies

SR Sri Rajan Syncfusion Team July 3, 2008 06:47 AM UTC

Hi Ed,

Thank you for your interest in Syncfusion products.

1) To Select cells programatically
>>>>

this.gridListControl1.Grid.Model.Selections.Add(GridRangeInfo.Cells(1, 1, 4, 3));


2) To Select Cells through mouse.
>>>>

void Grid_MouseUp(object sender, MouseEventArgs e)
{
IsMouseDown = false;
}

void Grid_MouseMove(object sender, MouseEventArgs e)
{
if (IsMouseDown)
{
Point pt = new Point(e.X, e.Y);
int row,col;
this.gridListControl1.Grid.PointToRowCol(pt, out row,out col);
this.gridListControl1.Grid.Selections.Add(GridRangeInfo.Cell(row, col)); }
}
bool IsMouseDown = false;
void Grid_MouseDown(object sender, MouseEventArgs e)
{
IsMouseDown = true;
}


Please let me know if this helps.

Best Regards,
Srirajan.



EW Edward Wilkerson July 3, 2008 03:04 PM UTC

Thanks so much
Since my concern is being able to select a variety of individual cells, update a table with those selections and highlight those cells when the gridlist is reopened would it have made move sense to use a GridControl?

>Hi Ed,

Thank you for your interest in Syncfusion products.

1) To Select cells programatically
>>>>

this.gridListControl1.Grid.Model.Selections.Add(GridRangeInfo.Cells(1, 1, 4, 3));


2) To Select Cells through mouse.
>>>>

void Grid_MouseUp(object sender, MouseEventArgs e)
{
IsMouseDown = false;
}

void Grid_MouseMove(object sender, MouseEventArgs e)
{
if (IsMouseDown)
{
Point pt = new Point(e.X, e.Y);
int row,col;
this.gridListControl1.Grid.PointToRowCol(pt, out row,out col);
this.gridListControl1.Grid.Selections.Add(GridRangeInfo.Cell(row, col)); }
}
bool IsMouseDown = false;
void Grid_MouseDown(object sender, MouseEventArgs e)
{
IsMouseDown = true;
}


Please let me know if this helps.

Best Regards,
Srirajan.





SR Sri Rajan Syncfusion Team July 4, 2008 08:58 AM UTC

Hi Ed,

Thank you for your continued interest in Syncfusion products.

If your intention is to persist selection,GridControl is the best choice instead of GridListControl. You can serialize your grids using GridModel.LoadBinary and GridModel.SaveBinary methods(or LoadSoap & SaveSoap methods). You can also change your GridControl to behave like a GridList Control.

Please refer the below code for GridControl Serialization:

Grid Samples-->Serialization-->GridControl

Local Path:
\My Documents\Syncfusion\EssentialStudio\6.1.0.34\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs

Please let me know if this helps.

Best Regards,
Srirajan.



EW Edward Wilkerson July 17, 2008 08:52 PM UTC

Hi Srirajan

Thank you so much for your help. I would like to alter the Custom Drop Down Gridlistcontrol so that the user may make multiple cell selections by right clicking a cell. The Drop Down may be closed and saved by double clicking when chosing the last selected cell

>Hi Ed,

Thank you for your continued interest in Syncfusion products.

If your intention is to persist selection,GridControl is the best choice instead of GridListControl. You can serialize your grids using GridModel.LoadBinary and GridModel.SaveBinary methods(or LoadSoap & SaveSoap methods). You can also change your GridControl to behave like a GridList Control.

Please refer the below code for GridControl Serialization:

Grid Samples-->Serialization-->GridControl

Local Path:
\My Documents\Syncfusion\EssentialStudio\6.1.0.34\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs

Please let me know if this helps.

Best Regards,
Srirajan.





EW Edward Wilkerson July 17, 2008 09:53 PM UTC

Hi Again

I don't really need the serialization. I store the selected values in the cell of the underlying grid. I would just like to be able to click or right click on the cells to select them (without using the CTRL key). When the user double clicks the values are saved into the underlying cell.

>Hi Srirajan

Thank you so much for your help. I would like to alter the Custom Drop Down Gridlistcontrol so that the user may make multiple cell selections by right clicking a cell. The Drop Down may be closed and saved by double clicking when chosing the last selected cell

>Hi Ed,

Thank you for your continued interest in Syncfusion products.

If your intention is to persist selection,GridControl is the best choice instead of GridListControl. You can serialize your grids using GridModel.LoadBinary and GridModel.SaveBinary methods(or LoadSoap & SaveSoap methods). You can also change your GridControl to behave like a GridList Control.

Please refer the below code for GridControl Serialization:

Grid Samples-->Serialization-->GridControl

Local Path:
\My Documents\Syncfusion\EssentialStudio\6.1.0.34\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs

Please let me know if this helps.

Best Regards,
Srirajan.







SR Sri Rajan Syncfusion Team July 28, 2008 12:39 PM UTC

Hi Ed,

Sorry for delay in getting back to you.

I am not able to understand you requirements clearly. Can you please provide me some more information?. That will help us to analyze this issue further.

Best Regards,
Srirajan.



BI Binu.A August 18, 2008 07:02 PM UTC

Dear Srirajan,
The sample given by you were useful. I have a requirement to have the Excel-like feature of formula copy. Presently when user mouse clicks on a cell with formula, the underlying formula is shown. The requirement is that if the user has formula =A1+B1 in cell C1 and he pastes the Formula in C2,then the formula should copied as =A2+B2 and the result should be shown.
Could you suggest me a best possible way to do this?

Thanks
Binu



SR Sri Rajan Syncfusion Team August 19, 2008 12:05 PM UTC

Hi Binu,

Thank you for your continued interest in Syncfusion products.

1) If you want Excell like Formula Copy, then you need to set FormulaCopyFlags property of the Formula engine as ClipBoardReferencesAdjusted.

2) If you want Excell like Formula Dragging, then you need to set the properties ExcelLikeCurrentCell, ExcelLikeSelectionFrame as true and set the

Controlleroptions as All. Also you need to add MouseControllerDispatcher. Here ExcelMarkerMouseController is custom MouseController.

Please refer the below code for more details.

//For Excell Like Formula Paste
GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardReferencesAdjusted;


//For Excell Like Formula Draging

this.gridControl1.ExcelLikeCurrentCell = true;
this.gridControl1.ExcelLikeSelectionFrame = true;

this.gridControl1.ControllerOptions = GridControllerOptions.All & (~GridControllerOptions.OleDataSource);
this.gridControl1.MouseControllerDispatcher.Add(new ExcelMarkerMouseController(this.gridControl1));



Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F74896Aug19/GridControl_FormulaPaste.zip

Please let me know if this helps.

Best Regards,
Srirajan.



MA muhammad alwan a replied to Edward Wilkerson February 26, 2018 03:13 PM UTC

Hi Again

I don't really need the serialization. I store the selected values in the cell of the underlying grid. I would just like to be able to click or right click on the cells to select them (without using the CTRL key). When the user double clicks the values are saved into the underlying cell.

>Hi Srirajan

Thank you so much for your help. I would like to alter the Custom Drop Down Gridlistcontrol so that the user may make multiple cell selections by right clicking a cell. The Drop Down may be closed and saved by double clicking when chosing the last selected cell

>Hi Ed,

Thank you for your continued interest in Syncfusion products.

If your intention is to persist selection,GridControl is the best choice instead of GridListControl. You can serialize your grids using GridModel.LoadBinary and GridModel.SaveBinary methods(or LoadSoap & SaveSoap methods). You can also change your GridControl to behave like a GridList Control.

Please refer the below code for GridControl Serialization:

Grid Samples-->Serialization-->GridControl

Local Path:
\My Documents\Syncfusion\EssentialStudio\6.1.0.34\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs

Please let me know if this helps.

Best Regards,
Srirajan.






thanks

Attachment: 3806_771d6550.rar


AR Arulpriya Ramalingam Syncfusion Team February 27, 2018 05:32 AM UTC

Hi Muhammad, 
 
Thanks for your update. 

Please let us know that whether you need further assistance on this. 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon