Can someone please help me with this. I found on the site how to select the entire range of the grid but it didn't explain the copy part which I am equally ignorant in.
I want to simply press a button and have the contents of the grid on the clipboard, ready to be dropped in excel. If possible I would like the logic to allow for the user to be able to group a number of different columns and only copy to the clipboard what is being displayed on the screen.
Thanks for the help.
What are you trying to select? All of the data rows in the grid in all groups? Or are you trying to select rows from only one group?
What version of the grid are you using?
This works so long as there is no grouping. But I need to be able to offer the ability to copy the grid whether it is grouped or not. Perhaps my pseudo code will better communicate my need.
If (ultragrid1.IsGrouped(True))
Select all rows with respect to the grouping
else if (ultragrid1.isGrouped(False))
(grid.Selected.Rows.AddRange(grid.Rows.GetAllNonGroupByRows())
After further search in the forums I came across this ...
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=6546
which showed me that the following is all you need...
grid.Selected.Rows.AddRange(grid.Rows.GetAllNonGroupByRows())
Thanks!
That was helpful and got me closer to where I need to be, but I'm not quite there.
"Once you have selected the rows you want" (this is the problem)
I'm achieving the copy on a single row ( with and without headers. I was unaware of all of those override properties) but how do I select more than one row? I know it sounds like a dumb question but I've tried CTRL + A, Shift + Select, Click + Mouse Drag and getting no where.
I've checked other places on the forum and this link seemed relevant...
this appears to return 1 row at a time, and I think I need one big copy statement, but that interpretation could be completely wrong.
I appreciate all the help!
P.S.
the thoroughness and understanding of Infragistics you guy's possess is impressive!
Hi,
Once you have selected the rows you want, copying to the clipboard is pretty simple. Make sure you have the grid set up to allow copying.
So make sure you have AllowMultiCellOperations (on the Override) set to allow copying. And then you can perform a copy operation in code like so:
this.ultraGrid1.PerformAction(UltraGridAction.Copy, false, false);
I'm not sure what you mean about grouping and the visible rows. Do you mean you only want to copy rows that are in the visible area of the grid? You want to exclude rows that are selected, but are scrolled out of view? I don't think there is any way to do that. But you could select only the rows that are in view using the grid.ActiveRowScrollRegion.VisibleRows collection.