We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Scrolling for Drag and Drop in GridDataBoundGrid

My GridDataBoundGrid control has several rows of data and I have to scroll down to get to the last row.I''m trying to drag a cell from the top of the grid to a row that is not currently visible in the grid ( because of the scroll position). When I drag beyond the grid control border, I expected it to scroll automatically. This does not happen. How do I achieve this? Thanks

3 Replies

SH Sue Harris February 15, 2005 06:18 PM

I achieve the auto scrolling by handling the DragOver event. The actual scrolling part is done with the following code, however theres also code in my function (which I haven''t posted here for size reasons) to ensure that it happens at a nice speed and draws nicely afterwards. bool hasScrolled = false; if(col == this.LeftColIndex && col > this.Model.Cols.FrozenCount + 1) { hasScrolled = true; base.LeftColIndex--; } else if(col == this.ViewLayout.LastVisibleCol && this.ViewLayout.HasPartialVisibleCols) { hasScrolled = true; base.LeftColIndex++; } else if(row == this.TopRowIndex && row > this.Model.Rows.FrozenCount + 1) { hasScrolled = true; base.TopRowIndex--; } else if(row == this.ViewLayout.LastVisibleRow && this.ViewLayout.HasPartialVisibleRows) { hasScrolled = true; base.TopRowIndex++; }


AD Administrator Syncfusion Team February 16, 2005 11:01 AM

Thanks. I did try this method before. I had used ScrollCellInView method. I also tried what you had suggested, but I just can''t get the grid to refresh. Methods Refresh, RefreshRange, Invalidate does not seem to work. Am I missing anything?


AD Administrator Syncfusion Team February 16, 2005 11:56 AM

I figured it out. You have to call EndUpdate() before refreshing if you scroll programatically. Apparently, BeginUpdate is being called when the dragging operation starts.

Loader.
Live Chat Icon For mobile
Up arrow icon