Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Grid Add Row – insert multiple records from copy/paste

Grid Add Row – insert multiple records from copy/paste

New Discussion
Stephen Crook
Stephen Crook asked on Nov 3, 2020 7:28 AM

My company has a database that the current UI is MS Access via ODBC (Yes I know ….)

Anyhow, I am trying to write a more robust UI but first I need to replicate some of the current features that Access gives us.

The biggest of which is I can select a range of cells in Excel (and assuming that the number of cells per row and data content is correct) can then select the insert row in Access and hit paste and it will insert multiple records into the table.

I am hoping it is somehow possible with UltraGrid to replicate this behavior. Actually I’m hoping it’s EASILY possible to replicate this behavior.

I currently have a Binding List of custom object type that gets set as the Ultragrid’s Datasource.

Right now I’m thinking that I’m going to have to do something like trapping the Ctrl+V keystroke, check to see if the active row is the add row, cancel the add row and then programmatically create new objects based on the clipboard data and add them to the binding list and then refresh the grid (all of which in my mind is a lot more complex to actually do than it sounds here)

If anyone else has already cracked this nut, I would appreciate any advice, tips, or help you can offer.

Thanks

Steve

Sign In to post a reply

Replies

  • 0
    Ivan Kitanov
    Ivan Kitanov answered on Oct 27, 2020 1:29 PM
    Hello Steve,
    Currently the UltraGrid doesn’t have such feature, however I have created a sample application, which copies a single row or a range of rows from excell to the UltraGrid.
    It uses the “BeforeUltraGridPerformAction” event of the grid, if the action is “Paste” it reads the text of the clipboard line by line and pastes it to the grid.
    Let me know if you have any questions.
    Sincerely,
    Ivan Kitanov
    Attachments:
    • 0
      Mike Saltzman
      Mike Saltzman answered on Oct 27, 2020 2:29 PM

      Actually… the grid DOES have this functionality built-in.

      All you really have to do is turn on the TempalteAddRow (AllowAddNew) and turn on MultiCellOperations for copy and paste. You can select multiple rows in the grid and copy and the select the TemplateAddRow and paste. Or you can select a range of cells (CellClickAction) and paste that into a valid cell in the TempalteAddRow and new rows are created. In my sample, I also have a Read-only primary key field so I also added an event handler for the grid’s Error event to handle this without prompting the user.

       

      • 0
        Stephen Crook
        Stephen Crook answered on Oct 30, 2020 8:39 PM

        Mike,

        Sorry it took me so long to get back here, had some trouble with my login .

        Anyhow in honor of Halloween – I dub thee the Fairy Godfather of Infragistics!!

        This is even simpler and easier that anything I could have wished for and I am almost ashamed to admit I had all of those settings in place, I just never thought it would work so I never tried it in my actual project.

        This is perfect!

        Thanks again and have a great weekend!

      • 0
        Ivan Kitanov
        Ivan Kitanov answered on Nov 3, 2020 7:28 AM

        Hello Steve,

        I am glad that you managed to achieve your requirement.

        Thank you for using Infragistics!

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Stephen Crook
Favorites
0
Replies
4
Created On
Nov 03, 2020
Last Post
5 years, 3 months ago

Suggested Discussions

Created by

Created on

Nov 3, 2020 7:28 AM

Last activity on

Feb 12, 2026 3:24 PM