Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1401
Issue with Cut and Paste with UltraWinGrid.UltraGridAction.Paste
posted

In Ultrawingrid when cut is selected from Menustrip and if I am trying to Paste it its pasting the empty cell instead of the data.

 

The code that given issue is:

void MenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)

{

if (e.ClickedItem == CopytoolStripMenuItem)

this.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.Copy);

else if (e.ClickedItem == CuttoolStripMenuItem)

this.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.Cut);

else if (e.ClickedItem == PastetoolStripMenuItem)

this.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.Paste);

else if (e.ClickedItem == DeletetoolStripMenuItem)

...........................

}

  • 469350
    Offline posted

    There are two different kinds of copy/paste in the grid.

    If you right-click on a cell in edit mode, then you will see the standard Copy/Paste menu that you get for any TextBox. That's because the cell actually uses a TextBox control. 

    If you select some cells or rows in the grid and copy those, then you are using the AllowMultiCellOperation functionality of the grid. This allows you to copy pecies of the grid like rows or mutliple cells - not just text. 

    The PerformAction method of the grid applies only to this second method of copy and paste. 

    If you want to copy text into a cell of a grid that was previously copied, then you need to handle that yourself via code, just as you would handle it for a TextBox. There are a couple of ways you could do this. One would be to simple set grid.ActiveCell.Value to the value from the clipboard.

    Another option would be to call PerformAction to place the grid's ActiveCell into edit mode, then use grid.Controls[0] to get the TextBox control the grid is using and call it's Paste method.