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

RadGrid Drap N Drop DestDataItem Always Null

10 Answers 348 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DanR
Top achievements
Rank 1
DanR asked on 24 May 2013, 09:23 PM
Hi:

I am trying to implement a RadGrid that provides Drag N Drop functionality. The RadGrid is in a User Control. When I move a row or rows, the RadGrid1_RowDrop code is called every time. However, the first step in RowDrop is to make sure you have the DestinationRow:
protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
{
    if (e.DestDataItem != null)
 
    .....drag n drop code here...

In my case e.DestDataItem is always null so the Drag and Drop code never executes. I read somewhere this might have something to do with RadAjaxPanel and RadAjaxLoadingPanel so I changed the Webform code that calls this User Control to:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
    <uc1:StructGrid ID="StructGrid" runat="server" /> 
</telerik:RadAjaxPanel>
 
<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>

Still, I always get null. Any suggestions?

Thanks, Dan

10 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 May 2013, 10:51 AM
Hello,

protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
        {
            if (e.DestDataItem == null)
            {
                // In your destination grid have row count is zero
                // you drop the row on tableview/mastertableview
            }
            else
            {
                // by using below property you can get grid
                e.DestinationGrid
                e.DestinationTableView
            }
        }


Thanks,
Jayesh Goyani
0
DanR
Top achievements
Rank 1
answered on 07 Jun 2013, 07:35 PM
Hi Jayesh:

Thank you for your response. I am sorry it has taken me some time to try and follow your suggestion. I do not think I understand what you are suggesting. I need to know the row upon which I am "dropping" the moved rows in the grid. Right? Because e.DestDataItem is always null in my test case, I am unsure how to do something like the following when I get to the RadGrid1_RowDrop event:

int recNo = (int)e.DestDataItem.GetDataKeyValue("RecordNo");

If I know the key for the row where I am dropping the rows, the rest of my code works fine. In your code, I am unsure of how I get the key for the row where I need to drop the rows if DestDataItem is null. And a second question is: what would cause DestDataItem to always be null? Can you please elaborate on your suggestion?

Thanks, Dan
0
Daniel
Telerik team
answered on 12 Jun 2013, 11:49 AM
Hello Dan,

I'm not sure what causes the problem at your side, but I created a simple demo created after your code-snippets and it works properly on my end. Could you please see if you could reproduce the issue with my website? You just need to add the Bin folder and the corresponding assemblies.

Regards,
Daniel
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Paria
Top achievements
Rank 1
answered on 22 Aug 2014, 07:49 AM
Hi, 

I encountered with this problem too..but finally i found it that e.Destdataitem is not null in IE and it works in IE but in chrome it doesn't work. Something strange here is, in the other computers it works in chrom as well!!!! please help me in this regard! 
0
Jayesh Goyani
Top achievements
Rank 2
answered on 24 Aug 2014, 06:11 PM
Hi,

Can you please provide your Telerik DLL version detail and some part of your code, So we will try to provide solution?

Thanks,
Jayesh Goyani
0
Henry
Top achievements
Rank 1
answered on 21 Mar 2015, 07:28 PM
same issue here, often null in chrome, firefox worked every time. 

version: 2014.3.1024.40
just use the sample code in the first post, you should be able to reproduce it.

what's the newest version? does it fix this?
0
Daniel
Telerik team
answered on 26 Mar 2015, 08:30 AM
Hello Henry,

There is a fully runnable demo in my post from 12-Jun-2013. I'm using Chrome 41.0.2272.76 m but unfortunately the problem does not reproduce on my end. I could make a video for you if needed.
Let me know if I'm missing something.

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Setiawan
Top achievements
Rank 1
answered on 26 Mar 2015, 08:37 PM
If you have zoomed in/out on the chrome browser, the drag and drop will not work (DestDataItem will be null)
0
Daniel
Telerik team
answered on 27 Mar 2015, 11:25 AM
Hello Setiawan,

This is not supported scenario. Zooming the browser in and out affects the coordinates and this leads to unpredictable behavior.

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Anatoliy
Top achievements
Rank 2
answered on 19 Oct 2015, 09:44 AM

Hi Jayesh,

Thank you for provided workaround solution for this problem in that I bumped too. Using DestinationTableView argument property in null-case helps enough. But it wasn't predictable and created some disturbing for someone's.

With regards, Anatoliy

Tags
Grid
Asked by
DanR
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
DanR
Top achievements
Rank 1
Daniel
Telerik team
Paria
Top achievements
Rank 1
Henry
Top achievements
Rank 1
Setiawan
Top achievements
Rank 1
Anatoliy
Top achievements
Rank 2
Share this question
or