I would like to use RadGrid drag'n drop feature to reorder a list of items.
So I follow your sample available at http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/DragAndDrop/DefaultCS.aspx
(Telerik.Web.UI.dll 2008.1.415.20)
It worked very well until I embed the grid into the content template of a master page. Then I cannot retreive the destination node in the drop event handler...
I do not understand why a master page causes this problem but the rest of the code is strictly the same :
Page without master page :
Page with master page (the master page is the default template, no extra code) :
Have you got an explaination for this issue?
Thanks,
Gilles
So I follow your sample available at http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/DragAndDrop/DefaultCS.aspx
(Telerik.Web.UI.dll 2008.1.415.20)
It worked very well until I embed the grid into the content template of a master page. Then I cannot retreive the destination node in the drop event handler...
I do not understand why a master page causes this problem but the rest of the code is strictly the same :
Page without master page :
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="WithoutMasterPage.aspx.cs" Inherits="WithoutMasterPage" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title>Page sans titre</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="scripManager" runat="server" /> |
| <telerik:RadGrid runat="server" ID="grdPendingOrders" Skin="Sunset" OnNeedDataSource="grdPendingOrders_NeedDataSource" AllowPaging="True" Width="350px" OnRowDrop="grdPendingOrders_RowDrop" AllowMultiRowSelection="true"> |
| <MasterTableView DataKeyNames="Id"> |
| </MasterTableView> |
| <ClientSettings AllowRowsDragDrop="True"> |
| <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> |
| </ClientSettings> |
| </telerik:RadGrid><asp:Label ID="LabelDestItem" runat="server" ForeColor="Red" /> |
| </form> |
| </body> |
| </html> |
Page with master page (the master page is the default template, no extra code) :
| <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="WithMasterPage.aspx.cs" Inherits="WithMasterPage" Title="Untitled Page" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> |
| <asp:ScriptManager ID="scripManager" runat="server" /> |
| <telerik:RadGrid runat="server" ID="grdPendingOrders" Skin="Sunset" OnNeedDataSource="grdPendingOrders_NeedDataSource" AllowPaging="True" Width="350px" OnRowDrop="grdPendingOrders_RowDrop" AllowMultiRowSelection="true"> |
| <MasterTableView DataKeyNames="Id"> |
| </MasterTableView> |
| <ClientSettings AllowRowsDragDrop="True"> |
| <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <asp:Label ID="LabelDestItem" runat="server" ForeColor="Red" /> |
| </asp:Content> |
Code behind is the same for the two pages :
In the first case, e.DestDataItem is correctly set, in the other it's always null.
protected void grdPendingOrders_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { List<GridItem> items = new List<GridItem>(); items.Add(new GridItem(1, "Item1")); items.Add(new GridItem(2, "Item2")); items.Add(new GridItem(3, "Item3")); this.grdPendingOrders.DataSource = items; } protected void grdPendingOrders_RowDrop(object sender, GridDragDropEventArgs e) { if (e.DestDataItem != null) { this.LabelDestItem.Text = "e.DestDataItem.OwnerGridID = " + e.DestDataItem.OwnerGridID; } else { this.LabelDestItem.Text = "e.DestDataItem is null!"; } }
Have you got an explaination for this issue?
Thanks,
Gilles