RadGrid Drap N Drop DestDataItem Always Null

11 posts, 0 answers
  1. DanR
    DanR avatar
    10 posts
    Member since:
    Sep 2009

    Posted 24 May 2013 Link to this post

    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
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 26 May 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. DanR
    DanR avatar
    10 posts
    Member since:
    Sep 2009

    Posted 07 Jun 2013 Link to this post

    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
  5. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 12 Jun 2013 Link to this post

    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.
  6. Paria
    Paria avatar
    1 posts
    Member since:
    Aug 2014

    Posted 22 Aug 2014 Link to this post

    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! 
  7. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 24 Aug 2014 in reply to Paria Link to this post

    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
  8. Henry
    Henry avatar
    42 posts
    Member since:
    Apr 2012

    Posted 21 Mar 2015 in reply to Jayesh Goyani Link to this post

    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?
  9. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 26 Mar 2015 Link to this post

    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.

     
  10. Setiawan
    Setiawan avatar
    7 posts
    Member since:
    Jul 2011

    Posted 26 Mar 2015 Link to this post

    If you have zoomed in/out on the chrome browser, the drag and drop will not work (DestDataItem will be null)
  11. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 27 Mar 2015 Link to this post

    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.

     
  12. Anatoliy
    Anatoliy avatar
    37 posts
    Member since:
    Oct 2012

    Posted 19 Oct 2015 in reply to Jayesh Goyani Link to this post

    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

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017