This is a migrated thread and some comments may be shown as answers.

Drag-Drop reordering with DataTable datasource

8 Answers 201 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 10 Sep 2008, 03:31 PM
I have a grid that I am populating from a DataTable object.$0$0$0$0I've enabled drag and drop reordering, and trying to figure out how to move the e.DraggedItems to the new location.  $0$0$0$0$0Does anyone have any examples of using the drag and drop reordering with a DataTable as the datasource for the grid control.$0$0$0$0$0I appreciate any help!$0$0$0$0$0Thanks! $0

8 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 10 Sep 2008, 03:46 PM
As an aside.... I posted that initial message with Google Chrome.  Could that have injected all of the "$0$0$0$0$0$0" ?
0
Rosen
Telerik team
answered on 12 Sep 2008, 04:52 AM
Hi Anthony,

I have attached a very simple implementation of a possible way to accomplish reordering of RadGrid items using a DataTable. Please give it a try and see if this helps.

All the best,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ed de Raaf
Top achievements
Rank 1
answered on 19 Dec 2008, 10:47 AM
Hi,

I'm trying to get this to work, but the GetDataKeyValue function returns either object reference not set or an invalid int exception. The problem to me seems to be that my grid.masterview has no keynames or values defined, which GetDataKeyValue needs(I suppose?). Also tried DestDataItem.DataItem to pinpoint the location of that dataitem in my table, but DataItem returns null.
So I'm kind of getting stuck with this. Some side information: I'm using a table from a typed dataset as datasource, maybe that has someting to do with it?
Help is appreciated!

Kamiel.

0
Sebastian
Telerik team
answered on 19 Dec 2008, 11:01 AM
Hi Ed,

Can you please verify that you added the names of the columns (from which you want to retrieve the respective values using the GetDataKeyValue method) to the DataKeyNames collection of the master table? Thus they should be available at each stage of the page lifecycle.

The DataItem property of the grid data item will be populated only in data-bound context (inside the ItemDataBound handler of the grid). The behavior is the same with the MS GridView control as well.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kamiel
Top achievements
Rank 1
answered on 19 Dec 2008, 12:49 PM
Hi,

I created my own account, because I was signed in under ed's account.

The DataKeyNames of my table are filled, I suppose, because I can run my application showing the radgrid with all the columns and their
names. But like I said in my previous post no results from GetDataKeyValue.

While waiting for your answer, I'm going to try to implement drag n drop by setting the rowid to a hidden label and using findcontrol to get the destination. I hope you can find a solution.

Kamiel.


0
Sebastian
Telerik team
answered on 19 Dec 2008, 12:55 PM
Hello Kamiel,

Can you please verify that the viewstate of your grid/page is enabled? Furthermore, can you replicate the issue by modifying the project attached previously in this thread? Thus we will do our best to provide up-to-the-point answer/solution. Thank you in advance for your cooperation.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kamiel
Top achievements
Rank 1
answered on 19 Dec 2008, 01:23 PM
Sebastian,

Both have viewstate enabled. I added a zip, I sure hope it's usefull. You'll have to replace the typed dataset stuff with your own, because I used back-end functions to get my data from the database.


*edit: how can I attach something to my post?
0
Sebastian
Telerik team
answered on 22 Dec 2008, 12:51 PM
Hi Kamiel,

Our public forums do not support file attachments, however you can start a formal support ticket from your account on our site and clip the modified version of the project (posted before by my colleague Rosen) to it.

Kind regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Rosen
Telerik team
Ed de Raaf
Top achievements
Rank 1
Sebastian
Telerik team
Kamiel
Top achievements
Rank 1
Share this question
or