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

[Solved] Drag and drop between two aspx pages

9 Answers 158 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
IQworks
Top achievements
Rank 1
IQworks asked on 19 Feb 2009, 02:29 AM
  Hi,
    I was thinking of creating two aspx pages.  I want to create a third aspx page with two Radpanes, and include the first two aspx pages on this third aspx page within the radpanes and then I would like to drag detailtables from one aspx page to the other. 
    I am wondering what the best way to do this might be ?
  thanks,
  David

9 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 24 Feb 2009, 03:25 PM
Hi David ,

We do not believe you can achieve your goal using RadSplitte control. The content pages inside panes are rendered inside iframes, therefore you cannot drag and drop controls between different pages.

Best wishes,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
IQworks
Top achievements
Rank 1
answered on 27 Mar 2009, 01:59 AM
Hi,
   I am wondering if having two radgrids in the same page is the only way to drag and drop between two radgrids.
   In other words, could I use a masterpage with two content pages and have two Usercontrol radgrids interact with drag and drop ? 
   My point is that I would like to create 1 radgrid that handles CRUD, and, that could be used for drag and drop, and , i may want to use that radgrid in different pages. Of course I would like to avoid having to copy the grid code to every new page I make that needs it. 
  I  understand that the code must sense the Destination and the Dragged items, just wondering if I can sense them in between two Usercontrol radgrids for instance, or, if there may be another way I am not aware of ?
  
thanks.
 
0
Sebastian
Telerik team
answered on 30 Mar 2009, 12:24 PM
Hi IQworks,

You can use different user controls (hosting grid instances) in the content pages and still utilizing drag and drop of grid rows between the two grids using the event-driven mechanism demonstrated in the relevant online demo/help topic:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx 
http://www.telerik.com/help/aspnet-ajax/drag-drop-grid-items.html

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
IQworks
Top achievements
Rank 1
answered on 08 Apr 2009, 04:50 PM
I need to explain more clearly.
I have 2 UserControls.
UserControlA and UserControlB. Both are RadGrids. I want to load these two user controls into a page. This page will be a content page. Then, I need to drag a row from UserControlA and drop this row into UserControlB.  The issue is sensing UserControlB as a destination Item. I am thinking once I do that, I can proceed with UserControlA and add the row to the database table that UserControlB reads, and then send an instruction to UserControlB to rebind.

The Examples you sent were the usual one page with 2 radgrids on them.

In the case where I am using two UserControls in one page, is there an example you can show me that explains how to sense the Destination item which would be UserControlB in my example ? I was thinking that there might be something I could do client-side ?
Or maybe the only thing I can do is have both grids in the same page (or both grids in one UserControl) in order to utilize the drag and drop mechanisms.

Of course I am trying to keep UserControlA its own unique entity because there will be times when I want to include UserControlA in other pages without UserControlB. And, times when I want to include UserControlB in other pages without UserControlA.

Right now, the only solution I see might be to have a page with both Grids, and have each grid in its own container (Div or Table). Then, make both visible when I want to drag and drop. And when I want to use one or the other, just make the one I want to use visible and the other one not visible.

thanks for any advice.
0
Sebastian
Telerik team
answered on 09 Apr 2009, 07:27 AM
Hello IQworks,

The arguments passed in the OnRowDrop server handler of the grid (e.DestDataItem, e.DestinationGrid, etc.) as explained in the articles pointed previously will remain unique regardless whether your second grid resides in the same user control/page or in another user control. Therefore, there is no point in 'sensing UserControlB' because you can have direct access to the second grid or its item drop target.

Let me know if I am missing something obvious.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
IQworks
Top achievements
Rank 1
answered on 09 Apr 2009, 06:40 PM
Hi Sebastian, 
    I think Its me thats missing the obvious because I am new to telerik. 
    In my succsseful drag and drop program, I have this code :
/* If a dragged item was put over a destination (DestDataItem != null) 
         * Then do this whole routine */ 
        if (e.DestDataItem != null && e.DestDataItem.OwnerGridID == RadGrid2.ClientID)  
        {  
            // Get The dragged item's index, MemberNo and the Exercise we are adding.   
            GridDataItem gtr = (GridDataItem)e.DraggedItems[0];  
            string gdi = gtr.OwnerTableView.Items[gtr.ItemIndex]["xmMemberNo"].Text;  
            string gds = gtr.OwnerTableView.Items[gtr.ItemIndex]["xmExerciseNo"].Text;  
            int sMember = System.Convert.ToInt32(gdi.ToString());  
            int sExercise = System.Convert.ToInt32(gds.ToString());  
 
 
            // The destination Workout to drop this new exercise into             
            string dky = "";  
            string dka = "";  
            int six = 0;  
            // IF the dragged item is being dropped on the workout header destination item
            // Get the key of the destination record to add the new item to
 
            if (e.DestDataItem.OwnerTableView.Name == "wkoOuts")  
            {  
                six = e.DestDataItem.ItemIndex;  
                dky = e.DestDataItem.OwnerTableView.Items[six]["wrMemberNo"].Text;  
                dka = e.DestDataItem.OwnerTableView.Items[six]["wrNumber"].Text;  
            }  
            //IF the dragged item is being dropped on any of the workout detail items. 
            // Get the key of the destination record to add the new item to from the parent. 
 
            if (e.DestDataItem.OwnerTableView.Name == "wkoExercise")  
            {  
                six = e.DestDataItem.OwnerTableView.ParentItem.ItemIndex;  
                dky = e.DestinationTableView.Items[six].OwnerTableView.Items[six]["wrMemberNo"].Text;  
                dka = e.DestinationTableView.Items[six].OwnerTableView.Items[six]["wrNumber"].Text;  
            }  
 
    This is the code I use to get the Key of  the Dragged item so I can add it to the table being read by the Destination Grid.
    And this code gets the key of the Destination Item I need when adding the Dragged item to the table being read by the destination
    Grid. 
     Since this code comes from a program that has both Grids in it, this is my question :
     When I have UserControlA and UserControlB with their own seperate individual Grids. How and where do I put the code to get the keys from the Dragged item and the keys from the Destination item ? I am wondering the following :
1) Since both UserControls are on the same page, do I need to use client-side rowDrop code to do this ?
2) If I have this rowDrop code in my draggeditem UserControl, how do I get the keys from the Destination UserControl's Grid ?

      Thanks for your time, 
      David
0
Sebastian
Telerik team
answered on 10 Apr 2009, 03:21 PM
Hi IQworks,

As explained previously, the e.DestinationDataItem. e.DestinationGrid and e.DraggedItems arguments are not dependant on the container which wraps your source and target grids/items.

If you want to access one of the grids from the other user control's code behind, merely call the FindControl(gridId) method directly for the corresponding user control to get referenece to it (as you will do with other two web server controls wrapped in different user control instances).

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
IQworks
Top achievements
Rank 1
answered on 12 Apr 2009, 06:12 AM
Sebastian,
  Thanks very much for advice. 
   I dont use code behind, but I had UserControlA and UserControlB referenced on a page, and, that page was the content page.
   When I dragged an item from UserControlA to UserControlB, my server rowdrop code in UserControlA (that i used for rowdrop when I had both grids in the same program) just needed to refer to the grid in UserControlB with the  prefix/tag
(<IQwkoPrefix:IQwkoTag ID="workout_Maint" runat="server" />)
in the content page, and prefix the Grid Name in UserControlB like this :
 workout_Maint_UserControlBGrid. 
Now I could see and refference all the rows and keys in UserControlB.
So, I was NOT seeing the obvious.
  Of course if you call up your web page that is the masterpage, the content with the two individual controls. And you "View Source" in the browser, you can clearly see both grids and there masterpage prefixed controlID's.  
Thanks again Sebastian, 
 IQworks
0
Sebastian
Telerik team
answered on 14 Apr 2009, 02:06 PM
Hello IQworks,

As explained in my previous post, you can reference the grid in the user control in the same way as with any other ASP.NET server control nested inside UserControlsB with id workout_Maint (i.e. calling the FindControl(controlId) method for it).

Let me know if I am missing something obvious. If you want to reference specific elements (destination grid, dragged items, destination item, etc.), use the arguments passed in the OnRowDrop handler.

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
IQworks
Top achievements
Rank 1
Answers by
Paul
Telerik team
IQworks
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or