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

RadGrid Drag and Drop...Stop scrolling during dragging

5 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aret
Top achievements
Rank 1
Aret asked on 26 Jun 2012, 02:00 PM
Hello,
I was able to successfully get the drag and drop functionality to work with my radgrid.  However, a small issue I am having is that as I drag my row from a grid on the top of my page to a grid on the bottom of my page, the grid I am dragging the row from begins to scroll as I am moving out of that grid.  Is there anyway I can disable the scrolling on the grid as I am dragging items from it.

I attached a picture of my issue to this post.  As you can see from the image, when I move the row from the top grid to the bottom of the page, the top grid scrolls all the way to the bottom.  I would like to freeze the scrolling of that grid as I drag items from it.

Please Help

5 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 29 Jun 2012, 11:35 AM
Hi Aret,

In order to avoid this behaviour you could set the "AllowAutoScrollOnDragDrop" client property to "false" like this:
<telerik:RadGrid runat="server" ID="grdPendingOrders" OnNeedDataSource="grdPendingOrders_NeedDataSource"
                AllowPaging="True" Width="350px" OnRowDrop="grdPendingOrders_RowDrop" AllowMultiRowSelection="true"
                PageSize="30" EnableHeaderContextMenu="true">
                <MasterTableView DataKeyNames="OrderId" TableLayout="Fixed">
                    <Columns>
                        <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" AllowAutoScrollOnDragDrop="false" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <ClientEvents OnRowDropping="onRowDropping" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                </ClientSettings>
                <PagerStyle Mode="NumericPages" PageButtonCount="4" />
            </telerik:RadGrid>

I hope this helps.


Greetings,
Maria Ilieva
the Telerik team
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 their blog feed now.
0
Aret
Top achievements
Rank 1
answered on 29 Jun 2012, 05:45 PM
THANK YOU SO MUCH MARIA!  That was the answer I was looking for.
0
MDS
Top achievements
Rank 1
answered on 31 Oct 2014, 03:44 PM
Dears, 

Is it possible to do the same on the custom RadGridView (Winforms) ?
AllowAutoScrollOnDragDrop does not exist. 

Best regards,
Dmitriy Utsmiyev.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Nov 2014, 12:37 PM
Hello Dmitriy,

Thank you for writing.

RadGridView from the Telerik UI for WinForms suite does not offer such a property. However, this is a reasonable request. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to adjust manually the TableElement.VScrollBar.Value. If the drag and drop functionality is implemented as it is demonstrated in the GridView >> Drag and Drop help article, you can use the following example to stop the scrolling behavior when dragging a row:
RadDragDropService dragDropService;
int scrollValue = 0;
 
public Form1()
{
    InitializeComponent();
 
    dragDropService = this.leftGrid.GridViewElement.GetService<RadDragDropService>();
    dragDropService.Started += dragDropService_Started;
    leftGrid.TableElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged;
}
 
private void dragDropService_Started(object sender, EventArgs e)
{
    scrollValue = this.leftGrid.TableElement.VScrollBar.Value;
}
 
private void VScrollBar_ValueChanged(object sender, EventArgs e)
{
    if (dragDropService != null && dragDropService.State == RadServiceState.Working)
    {
        this.leftGrid.TableElement.VScrollBar.Value = scrollValue;
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
MDS
Top achievements
Rank 1
answered on 10 Nov 2014, 10:23 AM
Desislava, 

It work, thanks. 

Best regards,
Dmitriy Utsmiyev.
Tags
Grid
Asked by
Aret
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Aret
Top achievements
Rank 1
MDS
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or