Hi,can anyone give me basic idea how to drag and drop rows between two ultragrids in c# and save data back to datatable.
Hello,
I am just checking about the progress of this issue. Let me know If you need our further assistance on this issue?
Thank you for using Infragistics Components.
abc xyz said:ya thanks it is working but problem here is when we drag and drop the rows it should display its original id but in the example that you have created it is giving some other id that is,for example if i drag id =1 from ultragrid 1 and dropping in ultragrid2,which alredy consists of 10 ids,that displayed id=1 from grid1 is showing as id=11 in ultragrid 2,instead of id=1.
The sample has a field which is set to AutoIncrement and it's specifically avoiding copying the key for this field. You can easily fix this by changing this line of code:
if (table.Columns[key].AutoIncrement || !string.IsNullOrEmpty(table.Columns[key].Expression)) continue;
to:
if (!string.IsNullOrEmpty(table.Columns[key].Expression)) continue;
But this will result in duplicate keys. Presumably your real application won't have duplicates keys in the two grids.
abc xyz said:and one more problem is when we drag one row may be id=1 from ultragrid1 and dropping in ultragrid2,the droped item is going to its original position that is to ultragrid1,but i need that it should stay in ultragrid2.
I don't understand what you mean by this. When I draw a row from one grid to the other, it always ends up at the bottom. It sounds like you are saying you want it to end up in the original position, but that's not logically possible, since there are a different number of rows in each grid. Do you want the rows in the grid to be sorted? If so, then it's a simple matter of sorting the grid by a column and then calling the RefreshSort method after you drop a row:
this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.RefreshSort();
ya thanks it is working but problem here is when we drag and drop the rows it should display its original id but in the example that you have created it is giving some other id that is,for example if i drag id =1 from ultragrid 1 and dropping in ultragrid2,which alredy consists of 10 ids,that displayed id=1 from grid1 is showing as id=11 in ultragrid 2,instead of id=1. and one more problem is when we drag one row may be id=1 from ultragrid1 and dropping in ultragrid2,the droped item is going to its original position that is to ultragrid1,but i need that it should stay in ultragrid2.
Thanks in advance.
I have implemented the basic idea in a basic sample on C#, which you will be able to run and evaluate.
Thank you for using Infragistics products.
hi,I have previously reffered that link but i need in c# and moreover is it not possible to drag the row from ultragrid and drop in second ultragrid and viceversa