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

[Solved] Is it possible to know source and destination row in OnRowDropping

1 Answer 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ericc34
Top achievements
Rank 1
ericc34 asked on 18 Nov 2009, 07:41 PM
I have a grid on I must manage drag drop of a row on another one to know if i must merge theses two rows. On onrowdropping client event, I must know source and destination dataitem. Is it possible ?

Here's the code of my grid

<

telerik:RadGrid ID="Schedule" runat="server" AllowSorting="True" SortingSettings-SortToolTip="<%$ Resources:ToolTipSort %>"

 

 

Skin="Office2007" GridLines="None" AutoGenerateColumns="False">

 

 

<clientsettings AllowRowsDragDrop="True">

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

 

<Selecting AllowRowSelect="True"/>

 

 

<ClientEvents OnRowDropping="onScheduleRowDropping"/>

 

 

</clientsettings>

 

 

<mastertableview commanditemdisplay="Top" datakeynames="ID" clientdatakeynames="ID"

 

 

gridlines="None" tablelayout="Auto" allowmulticolumnsorting="true">

 

 

<CommandItemTemplate>

 

 

</CommandItemTemplate>

 

 

<GroupByExpressions>

 

 

<telerik:GridGroupByExpression>

 

 

<SelectFields>

 

 

<telerik:GridGroupByField FieldName="DateBegin" FormatString="{0:D}" HeaderText=" "

 

 

HeaderValueSeparator=""></telerik:GridGroupByField>

 

 

</SelectFields>

 

 

<GroupByFields>

 

 

<telerik:GridGroupByField FieldName="DateBegin" SortOrder="Ascending"></telerik:GridGroupByField>

 

 

</GroupByFields>

 

 

</telerik:GridGroupByExpression>

 

 

</GroupByExpressions>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn HeaderText="<%$ Resources:Hour_GridHeader %>" ItemStyle-VerticalAlign="Top"

 

 

HeaderStyle-Width="80px" ItemStyle-Width="80px">

 

 

<ItemTemplate>

 

<%

#DataBinder.Eval(Container.DataItem, "Hours")%>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="<%$ Resources:Description_GridHeader %>"

 

 

ItemStyle-VerticalAlign="Top" HeaderStyle-Width="100%" ItemStyle-Width="100%">

 

 

<ItemTemplate>

 

 

<span style="position: relative; vertical-align: top">

 

 

<asp:Image ID="imgType" runat="server" />

 

 

<asp:Label ID="lblDescription" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Description")%>'></asp:Label>

 

 

</span>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="<%$ Resources:Priority_GridHeader %>" HeaderStyle-HorizontalAlign="Center"

 

 

ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="90px"

 

 

ItemStyle-Width="90px">

 

 

<ItemTemplate>

 

<%

#DataBinder.Eval(Container.DataItem, "PriorityDisplay")%>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn ItemStyle-VerticalAlign="Top" HeaderStyle-Width="60px"

 

 

ItemStyle-Width="60px">

 

 

<ItemTemplate>

 

 

<span id="ActionsToolBar" runat="server" onclick="event.cancelBubble=true;">

 

 

<telerik:RadToolBar ID="ActionsRadToolBar" runat="server" Skin="Office2007" OnClientButtonClicked="ActionsRadToolBar_OnClientButtonClicked" AppointmentId='<%# Eval("ID") %>'>

 

 

<Items>

 

 

<telerik:RadToolBarDropDown runat="server" Text="<%$ Resources:ActionsToolBarMenu %>" Width="100%" Height="18px">

 

 

<Buttons>

 

 

</Buttons>

 

 

</telerik:RadToolBarDropDown>

 

 

</Items>

 

 

</telerik:RadToolBar>

 

 

</span>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn UniqueName="HasWarningUnavailabilityConflict" DataField="HasWarningUnavailabilityConflict"

 

 

Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="HasWarningResourceConflict" DataField="HasWarningResourceConflict"

 

 

Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="AppointmentType" DataField="AppointmentType"

 

 

Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="Priority" DataField="Priority" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="IsFinished" DataField="IsFinished" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="IsCanceled" DataField="IsCanceled" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="FromOldPlanVersion" DataField="FromOldPlanVersion" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="ManualCreation" DataField="ManualCreation" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="VisitType" DataField="VisitType" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn UniqueName="IsUnasigned" DataField="IsUnasigned" Display="false">

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

<NoRecordsTemplate>

 

 

<asp:Literal ID="litNoRecords" runat="server" Text="<%$ Resources:NoRecords %>"></asp:Literal>

 

 

</NoRecordsTemplate>

 

 

</mastertableview>

 

 

</telerik:RadGrid>

And I want in OnRowDropping compare the AppointmentType to see if two rows had the same value

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Nov 2009, 08:12 AM
Hello Eric,

You can access the dragged grid row id in the OnRowDragStarted client event of the grid, pass it over to a global variable and then access it in any other client event. Check the following help document which shows an example of how to get the id of the dragged row:
OnRowDragStarted
Then you can make use of the OnRowDropping client event of the grid to access the dropped target element id as explained in the following help link:
OnRowDropping

Also, the following online demo link may be of help. Take a look at it:
Items Drag-and-drop

Thanks
Princy.
Tags
Grid
Asked by
ericc34
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or