none
Moving rows inside ListObject broke underlying DataSource RRS feed

  • Question

  • I'm using VS 2010 SP1 and targeting .Net 3.5 and Office 2010.
    I have application-level Excel AddIn. It creates ListObject, which is bound to DataTable.
    This ListObject has 3 rows.
    If I select first row (using mouse click on row header) and move it between second and third rows (using Shift + Drag&Drop), ListObject completely deletes second row and makes a copy of first row in DataTable.

    It looks like this:

    Original data:



    After moving of first row:



    I created sample project which can help to reproduce this problem.
    To create ListObject user should go to Add-Ins ribbon and click "Create ListObject" button
    http://sdrv.ms/Zci8qv

    Thanks,
    Yevgen


    Thursday, April 11, 2013 8:00 PM

Answers

  • I am not sure this is a bug, you can also refer to the link to get help,

    After you drag &drop, the datasource have changed, so you should save the change to datasource by using Update method. you can try this way firstly.

    If that method doesn't work, you can submit the issue to microsoft from here. For how to submit a bug, you also can refer to the thread.

    Thanks.


    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer.

    Monday, April 15, 2013 2:00 PM

All replies

  • I test it on my machine, the result is right which deletes second row and makes a copy of first row in DataTable,  and when i Drag &drop, When I drag &drop, there is message pop up as "Whether replace the target cell content"

    When I click Ok button, the result is expected ,the result like:

    So I think you can try office whether instal correctly or try the operation again.


    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer.

    Friday, April 12, 2013 4:41 PM
  • Thanks for your answer.

    But pay your attention, that you need to move first row when Shift button is pressed. In this case Excel inserts moved row between two other and doesn't suggest to replace target cells. 

    I found video where the same approach used: 

    http://www.youtube.com/watch?v=PNsDdcNz8Lg

    Thanks,

    Yevgen

    Friday, April 12, 2013 4:57 PM
  • I think you should handle SelectedIndexChanged Event after binding dataTable to ListObject,  you can add the following codes:

      list1.SelectedIndexChanged += new EventHandler(list1_SelectedIndexChanged);

    and call ListObject.RefreshDataRows() method in list1_SelectedIndexChanged method.

      public void list1_SelectedIndexChanged(object sender, EventArgs e)
            {
                list1.RefreshDataRows();
            }


    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer.

    Saturday, April 13, 2013 8:34 AM
  • Does it work for you?

    For me, DataTable is valid, but first row in ListObject, which I tried to move, remains first, but should be second...

    Thanks,

    Yevgen

    Monday, April 15, 2013 1:30 PM
  • Yes, It is the same with you in my side, but I think it is an issue with ListObject in VSTO technology. I search more in the internet but not resolve the problem.

    Thanks

     

    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer.

    Monday, April 15, 2013 1:32 PM
  • So if this is the bug in VSTO, can it be reported and fixed? How this can be done?

    Thanks

    Monday, April 15, 2013 1:38 PM
  • I am not sure this is a bug, you can also refer to the link to get help,

    After you drag &drop, the datasource have changed, so you should save the change to datasource by using Update method. you can try this way firstly.

    If that method doesn't work, you can submit the issue to microsoft from here. For how to submit a bug, you also can refer to the thread.

    Thanks.


    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer.

    Monday, April 15, 2013 2:00 PM