C# copy gridview contents to clipboard
I have several gridviews. In each of them, I copy the contents to the clipboard using code like this:
GV_Master.SelectAll();
DataObject dataObj = GV_Master.GetClipboardContent(); Clipboard.SetDataObject(dataObj, true); GV_Master.ClearSelection();On most cases this works as intended, copying the entire contents of the Gridview to the clipboard. In one case it copies only the cell in which I right clicked to invoke the context menu that calls the code above. The t开发者_运维知识库hing that is obviously different is that the gridviews that work have a data source, and the one that doesn't has rows that I individually populate. However, if what is being copied is the contents of the clipboard rather than the datasource, I don't see why this should matter.
What am I missing?
Setting the gridview multiselect to true, and selectionmode to fullrowselect seems to have done the trick. Silly to have missed this before.
精彩评论