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

RadGrid1_RowDrop is being Executed on Page Reload Unnecessarily

2 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
shawn asked on 25 Aug 2015, 07:13 PM

Hi, I have a page (SiteScheduler.aspx) with a RadGrid and a RadScheduler on it and I followed the online examples of how to drag and drop rows from the RadGrid to the RadScheduler - and it works perfectly.  I wired up a RadWindow to open from a ContextMenu - and the RadWindow, which is modal and appears over SiteScheduler.aspx, allows the user to change the assigned staff person to the appointment in the scheduler.   Here again, that functionality works great.    My staff person reassignment correction is made.   When the RadWindow closes, it executes   document.location.reload() to refresh SiteScheduler.aspx.  

My problem I ran into yesterday and still today is that if I had dragged a row from the RadGrid to the Scheduler  prior to right clicking and open the RadWindow to reassign the staff person, the RadGrid1_RowDrop event is executed again on the document.location.reload() (or F5 for that matter).   This causes an incorrectly scheduled staff person.  It's like the RowDrop is still 'remembering' the prior drop action and even the same row that was dragged before  to the RadWindow opening.

If I do not drag a row from the grid to the scheduler before right clicking to open the RadWindow to reassign the staff person,  the RadGrid1_RowDrop event is not executed and it works as required.

Here are a couple of things I tried:

1.  Thought it might be cache related so I turned off client side caching by placing this in Page_load


2.  Because of the way the page works , I had to set EnableAJAX="False" in the RadAjaxManager.   I would love to be able refresh just the scheduler but don't know how to do this with EnableAJAX="False"  being set.

3.  I tried to simulate the click event of a button that refreshes and rebinds the scheduler however the button does not exist in the RadWindow close event (as the form's controls are not present yet) so it does not work.

Is there something I am missing or do you have any suggestions?  Is there a way to 'Cancel' or dispose of the prior RadGrid RowDrop event once it is complete so it is not executed again?

Here is my RadGrid definition if it helps:

 <telerik:RadGrid runat="server" ID="RadGrid1" Skin="Metro" Style="border: none; outline: 0;"
                AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Height="800px"
                AllowAutomaticDeletes="True" MasterTableView-DataKeyNames="StaffId" OnItemCommand="RadGrid1_ItemCommand"
                OnItemCreated="RadGrid1_ItemCreated" OnRowDrop="RadGrid1_RowDrop" OnRowDropped="RadGrid1_RowDropped" AutoGenerateColumns="False" PageSize="30" RenderMode="Lightweight" Width="100%"
                RetainExpandStateOnRebind="True" ClientSettings-AllowAutoScrollOnDragDrop="False">
                <ClientSettings AllowRowsDragDrop="True">
                    <Selecting AllowRowSelect="True"></Selecting>
                    <ClientEvents OnRowDropping="rowDropping" OnRowDblClick="onRowDoubleClick"></ClientEvents>
                    <Scrolling AllowScroll="True" ScrollHeight="800px" UseStaticHeaders="True" />
                <MasterTableView DataKeyNames="StaffId" RetainExpandStateOnRebind="True">
                    <RowIndicatorColumn Visible="False">
                        <telerik:GridBoundColumn DataField="StaffFullName" FilterControlAltText="Filter colStaffname column" Groupable="False" HeaderText="Staff Name" ReadOnly="True" Reorderable="False" UniqueName="colStaffname" HeaderTooltip="skdj">
                <FilterMenu RenderMode="Lightweight"></FilterMenu>
                <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>


Thanks for any help you can provide.


2 Answers, 1 is accepted

Sort by
Angel Petrov
Telerik team
answered on 28 Aug 2015, 06:47 AM

I have already provided an answer regarding this matter in the official support ticket you have opened. In order to avoid duplicate posts I suggest we continue our conversation there. Once we are able to resolve the matter you can share your findings here thus helping other community members overwhelm such problems.

Angel Petrov
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Top achievements
Rank 1
answered on 28 Aug 2015, 11:55 AM

Hi Angel...just to help others who may have the same issue,

Thanks for your reply.  I actually just figured out a workaround for this.   Due to the architecture of my page it would be very time consuming to create a code snippet or to re-architect an Ajax solution, time that unfortunately I don't have.    I got around it by storing the StaffId and the targetSlotIndex in  session vars on each successful drag and drop event.  On page refresh, the Radgrid1_Rowdrop still fires again as it is still 'remembering' the last event....and I just compare the staffId and targetSlotIndex with the session vars.  If they are the same I basically bypass the RadGrid1_Rowdrop execution, otherwise if a different staffId and/or time slot I let the drag/drop event process and finish normally.   Works like a charm!


Asked by
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Top achievements
Rank 1
Share this question