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

[Solved] Drag n Drop for Export

5 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bradley baker
Top achievements
Rank 1
bradley baker asked on 09 Oct 2009, 08:39 PM
I want to make a Drag n Drop grid where the user can drag line items to from the Primary Grid to a 2nd Grid which they will then use the 2nd Grid to export to XLS/PDF.

Grid 1 contains a all the line items of orders from our ERP system, I want them to be able to filer this etc and drag individual lines to another grid and when they have brought over all the lines they want then export it to xls/pdf (I dont want to store any of the information in a database for the items in Grid2.  I just basically want a place holder so they can add diffrent lines from mutiple orders/po/customers and then be able to export them insted of having to copy/paste each time they would do a search.

I looked over the examples currently and they all appear to be storeing the information in another database

5 Answers, 1 is accepted

Sort by
0
bradley baker
Top achievements
Rank 1
answered on 13 Oct 2009, 03:39 PM
Bump
0
Schlurk
Top achievements
Rank 2
answered on 14 Oct 2009, 02:59 PM
You could just have an empty DataSet that you use as a data source for the Grid and using similar logic as in the demo you simply rebind to this DataSet and then either clear it or remove it when you are done exporting. This way you don't have to bind to a database.
0
bradley baker
Top achievements
Rank 1
answered on 14 Oct 2009, 04:35 PM
What am I missing... I got the page to load and when I drag and drop to the 2nd grid nothing happens :(

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="sales_expidite.aspx.vb" Inherits="sales_sales_expidite" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="Header" Runat="Server">  
<script type="text/javascript">  
                <!--  
                    function onRowDropping(sender, args) {  
                    alert(sender.get_id())  
                        if (sender.get_id() == "<%=SalesEXPGrid.ClientID %>") {  
                        alert("Test")  
                            var node = args.get_destinationHtmlElement();  
                            if (!isChildOf('<%=grdShippedOrders.ClientID %>', node) && !isChildOf('<%=SalesEXPGrid.ClientID %>', node))  
                            {   
                                args.set_cancel(true);   
                            }   
                        }  
                        else  
                        {   
                            var node = args.get_destinationHtmlElement();   
                            if(!isChildOf('trashCan', node))  
                            {   
                                args.set_cancel(true);   
                            }  
                            else  
                            {  
                                if (confirm("Are you sure you want to delete this order?"))  
                                    args.set_destinationHtmlElement($get('trashCan'));  
                                else  
                                   args.set_cancel(true);   
                            }  
                        }  
                    }  
                      
                    function isChildOf(parentId, element)  
                    {  
                        while(element)  
                        {   
                            if (element.id && element.id.indexOf(parentId) > -1)  
                            {   
                                return true;  
                            }  
                            elementelement = element.parentNode;  
                        }  
                        return false;  
                    }  
                --> 
            </script> 
 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="PrimaryContent" Runat="Server">  
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="SalesEXPGrid">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="SalesEXPGrid" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 
    <asp:SqlDataSource ID="SalesEXPSQL" runat="server"   
        ConnectionString="<%$ ConnectionStrings:ERPLXFConnectionString %>"   
        SelectCommand="SELECT RTRIM(ECH.HCPO) as HCPO, RTRIM(ECL.LORD) as LORD, ECH.HCOMP, ECL.LLINE, ECL.LPROD, ECL.LDESC, ECL.LRDTE, LLL.LLSDTE, LLC.LCCRTN, LLH.LHPRON, LLL.LLSQTY, ECL.LQORD, ECH.HCUST, LCM.CMCDES, ECH.HNAME FROM ECL LEFT OUTER JOIN LLL ON ECL.LORD = LLL.LLORDN AND ECL.LLINE = LLL.LLOLIN LEFT OUTER JOIN ECH ON ECL.LORD = ECH.HORD LEFT OUTER JOIN LLC ON LLL.LLLOAD = LLC.LCLOAD AND ECL.LLINE = LLC.LCOLIN LEFT OUTER JOIN LLH ON LLL.LLLOAD = LLH.LHLOAD AND ECL.LLINE = LLH.LHTLNE LEFT OUTER JOIN LCM ON LLH.LHCARR = LCM.CMCARR WHERE (ECL.LRDTE &gt;= CONVERT (char(8), GETDATE(), 112) - 20000) ORDER BY ECL.LORD, ECL.LLINE"></asp:SqlDataSource> 
    <telerik:RadGrid ID="SalesEXPGrid" runat="server" ShowGroupPanel="True" GridLines="None" 
            DataSourceID="SalesEXPSQL" AllowFilteringByColumn="True" AllowPaging="True"   
                AllowSorting="True" PageSize="50" EnableHeaderContextMenu="True">  
            <HeaderContextMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </HeaderContextMenu> 
            <MasterTableView GroupLoadMode="server" AutoGenerateColumns="False" GroupsDefaultExpanded="False" 
                             DataKeyNames="LORD,LLINE">  
                <Columns> 
                    <telerik:GridBoundColumn DataField="HCPO" HeaderText="PO No."   
                        SortExpression="HCPO" UniqueName="HCPO">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LORD" 
                        HeaderText="Order No." SortExpression="LORD" UniqueName="LORD">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LLINE" 
                        HeaderText="Line No." SortExpression="LLINE" UniqueName="LLINE">  
                    </telerik:GridBoundColumn>                      
                    <telerik:GridBoundColumn DataField="LPROD" HeaderText="Item No"   
                        SortExpression="LPROD" UniqueName="LPROD">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HCUST"   
                        HeaderText="Cust No" SortExpression="HCUST" UniqueName="HCUST">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HNAME" HeaderText="Cust Name"   
                        SortExpression="HNAME" UniqueName="HNAME">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HCOMP" 
                        HeaderText="Company No." SortExpression="HCOMP" UniqueName="HCOMP">  
                    </telerik:GridBoundColumn>                      
                </Columns> 
                <ItemTemplate> 
                    <b>Cust No</b>:  
                    <asp:Label ID="Label12" runat="server" Text='<%# Eval("HCUST") %>'></asp:Label> 
                    <br /> 
                    <b>Cust Name</b>:  
                    <asp:Label ID="Label13" runat="server" Text='<%# Eval("HNAME") %>'></asp:Label> 
                    <br />                  
                    <b>PO No</b><asp:Label ID="Label1" runat="server" Text='<%# Eval("HCPO") %>'></asp:Label> 
                    <br /> 
                    <b>Order No</b><asp:Label ID="Label2" runat="server" Text='<%# Eval("LORD") %>'></asp:Label> 
                    <br /> 
                    <b>Line No</b><asp:Label ID="Label3" runat="server" Text='<%# Eval("LLINE") %>'></asp:Label> 
                    <br /> 
                    <b>Item No</b><asp:Label ID="Label4" runat="server" Text='<%# Eval("LPROD") %>'></asp:Label> 
                    <br /> 
                    <b>Desc</b><asp:Label ID="Label5" runat="server" Text='<%# Eval("LDESC") %>'></asp:Label> 
                    <br /> 
                    <b>Sched Ship</b><asp:Label ID="Label6" runat="server" Text='<%# Eval("LRDTE") %>'></asp:Label> 
                    <br /> 
                    <b>Ship Date</b>:  
                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("LLSDTE") %>'></asp:Label> 
                    <br /> 
                    <b>Ship Mthd</b>:  
                    <asp:Label ID="Label14" runat="server" Text='<%# Eval("CMCDES") %>'></asp:Label> 
                    <br /> 
                    <b>Tracking No</b>:  
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("LCCRTN") %>'></asp:Label> 
                    <br /> 
                    <b>Pro No</b>:  
                    <asp:Label ID="Label9" runat="server" Text='<%# Eval("LHPRON") %>'></asp:Label> 
                    <br /> 
                    <b>Qty Ship</b>:  
                    <asp:Label ID="Label10" runat="server" Text='<%# Eval("LLSQTY") %>'></asp:Label> 
                    <br /> 
                    <b>Qty Ord</b>:  
                    <asp:Label ID="Label11" runat="server" Text='<%# Eval("LQORD") %>'></asp:Label> 
                </ItemTemplate> 
                <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                       <GroupByFields> 
                            <telerik:GridGroupByField FieldName="LORD" /> 
                            <telerik:GridGroupByField FieldName="HCPO" /> 
                       </GroupByFields> 
                       <SelectFields> 
                            <telerik:GridGroupByField FieldName="HCOMP" HeaderText="Company No" /> 
                            <telerik:GridGroupByField FieldName="LORD" HeaderText="Order No" /> 
                            <telerik:GridGroupByField FieldName="HCPO" HeaderText="PO No" /> 
                       </SelectFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" AllowRowsDragDrop="True">  
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />   
            </ClientSettings> 
            <FilterMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </FilterMenu> 
        </telerik:RadGrid> 
          
<telerik:RadGrid runat="server" AllowPaging="True" ID="grdShippedOrders" OnNeedDataSource="grdShippedOrders_NeedDataSource" 
                    AllowMultiRowSelection="true" PageSize="8" OnRowDrop="grdShippedOrders_RowDrop">  
                    <MasterTableView DataKeyNames="OrderId,PoNo,LineNo">  
                        <NoRecordsTemplate> 
                            <div style="height: 30px; cursor: pointer;">  
                                No items to view</div> 
                        </NoRecordsTemplate> 
                        <PagerStyle Mode="NumericPages" PageButtonCount="4" /> 
                    </MasterTableView> 
                    <ClientSettings AllowRowsDragDrop="True">  
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>  
                        <ClientEvents OnRowDropping="onRowDropping" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 
         
</asp:Content> 
 
 
Imports System  
Imports System.Collections.Generic  
Imports System.Configuration  
Imports System.Data  
Imports System.Data.Common  
Imports System.Data.SqlClient  
Imports System.Web.UI  
Imports Telerik.Web.UI  
 
Partial Class sales_sales_expidite  
    Inherits System.Web.UI.Page  
 
    Protected Sub SalesEXPSQL_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SalesEXPSQL.Selecting  
        e.Command.CommandTimeout = 0  
    End Sub 
 
    Protected Property ShippedOrdersStore() As IList(Of Order)  
        Get 
            Try 
                Dim obj As Object = Session("ShippedOrders_VB")  
                If obj Is Nothing Then 
                    obj = New List(Of Order)()  
                    Session("ShippedOrders_VB") = obj  
                End If 
                Return DirectCast(obj, IList(Of Order))  
            Catch ex As Exception  
                Session("ShippedOrders_VB") = Nothing 
            End Try 
            Return New List(Of Order)  
        End Get 
        Set(ByVal value As IList(Of Order))  
            Session("ShippedOrders_VB") = value  
        End Set 
    End Property 
 
    Protected Sub grdShippedOrders_NeedDataSource(ByVal source As ObjectByVal e As GridNeedDataSourceEventArgs)  
        grdShippedOrders.DataSource = ShippedOrdersStore  
    End Sub 
 
    Private Shared Function GetOrder(ByVal ordersToSearchIn As IEnumerable(Of Order), ByVal orderId As IntegerByVal lineNo As IntegerAs Order  
        For Each order As Order In ordersToSearchIn  
            If order.OrderId = orderId Then 
                MsgBox("Test")  
                If order.LineNo = lineNo Then 
                    Return order  
                End If 
            End If 
        Next 
        Return Nothing 
    End Function 
 
    Protected Sub grdShippedOrders_RowDrop(ByVal sender As ObjectByVal e As GridDragDropEventArgs)  
        If Not String.IsNullOrEmpty(e.HtmlElement) AndAlso e.HtmlElement = "trashCan" Then 
            Dim shippedOrders As IList(Of Order)  
            shippedOrders = ShippedOrdersStore  
            Dim deleted As Boolean = False 
 
            For Each draggedItem As GridDataItem In e.DraggedItems  
                Dim tmpOrder As Order = GetOrder(shippedOrders, DirectCast(draggedItem.GetDataKeyValue("LORD"), Integer), DirectCast(draggedItem.GetDataKeyValue("LLINE"), Integer))  
 
                If tmpOrder IsNot Nothing Then 
                    deleted = True 
                    shippedOrders.Remove(tmpOrder)  
                End If 
            Next 
            ShippedOrdersStore = shippedOrders  
            grdShippedOrders.Rebind()  
        End If 
    End Sub 
 
 
    Protected Class Order  
        Private _companyName As String 
        Private _customerId As Integer 
        Private _orderId As Integer 
        Private _poNo As String 
        Private _lineNo As Integer 
        Private _itemNo As String 
        Private _desc As String 
        Private _schdShip As Integer 
        Private _shipDate As Integer 
        Private _shipMth As String 
        Private _trackingNo As String 
        Private _proNo As String 
        Private _qtyShip As String 
        Private _qtyOrd As String 
 
        Public Sub New(ByVal orderId As IntegerByVal customerId As StringByVal companyName As StringByVal poNo As StringByVal lineNo As IntegerByVal itemNo As StringByVal desc As StringByVal schdShip As IntegerByVal shipDate As IntegerByVal shipMth As StringByVal trackingNo As StringByVal proNo As StringByVal qtyShip As StringByVal qtyOrd As String)  
            _orderId = orderId  
            _customerId = customerId  
            _companyName = companyName  
            _poNo = poNo  
            _lineNo = lineNo  
            _itemNo = itemNo  
            _desc = desc  
            _schdShip = schdShip  
            _shipDate = shipDate  
            _shipMth = shipMth  
            _trackingNo = trackingNo  
            _proNo = proNo  
            _qtyShip = qtyShip  
            _qtyOrd = qtyOrd  
 
        End Sub 
 
        Public ReadOnly Property Company() As String 
            Get 
                Return _companyName  
            End Get 
        End Property 
        Public ReadOnly Property CustomerID() As String 
            Get 
                Return _customerId  
            End Get 
        End Property 
        Public ReadOnly Property PoNo() As String 
            Get 
                Return _poNo  
            End Get 
        End Property 
        Public ReadOnly Property OrderId() As Integer 
            Get 
                Return _orderId  
            End Get 
        End Property 
        Public ReadOnly Property LineNo() As Integer 
            Get 
                Return _lineNo  
            End Get 
        End Property 
        Public ReadOnly Property ItemNo() As String 
            Get 
                Return _itemNo  
            End Get 
        End Property 
        Public ReadOnly Property Desc() As String 
            Get 
                Return _desc  
            End Get 
        End Property 
        Public ReadOnly Property SchdShip() As Integer 
            Get 
                Return _schdShip  
            End Get 
        End Property 
        Public ReadOnly Property ShipDate() As Integer 
            Get 
                Return _shipMth  
            End Get 
        End Property 
        Public ReadOnly Property ShipMth() As String 
            Get 
                Return _shipMth  
            End Get 
        End Property 
        Public ReadOnly Property TrackingNo() As String 
            Get 
                Return _trackingNo  
            End Get 
        End Property 
        Public ReadOnly Property ProNo() As String 
            Get 
                Return _proNo  
            End Get 
        End Property 
        Public ReadOnly Property QtyShip() As String 
            Get 
                Return _qtyShip  
            End Get 
        End Property 
        Public ReadOnly Property QtyOrd() As String 
            Get 
                Return _qtyOrd  
            End Get 
        End Property 
    End Class 
End Class 
 
 
 
0
bradley baker
Top achievements
Rank 1
answered on 14 Oct 2009, 06:08 PM
Well I figured out part of it so now the Javascript is being called.  But whenever I drag n drop its still not working but atleast time time it should be calling the right function =)

I Get error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
Timestamp: Wed, 14 Oct 2009 18:20:22 UTC

Message: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Line: 6
Char: 62099
Code: 0
URI: http://bfd111sweb2t/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_MasterRadScriptManager_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ad0c4ca6e-6b5d-49b6-922d-5244924fb100%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.2.701.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ad5b69bca-cfa7-4e0a-9dd0-824ae4c4ef5a%3a16e4e7cd%3af7645509%3aed16cbdc%3a24ee1bba%3ae330518b%3a1e771326%3ac8618e41%3a854aa0a7%3a874f8ea2%3a5a6d9d23%3a59462f1%3aa51ee93e%3a58366029%3aaa288e2d%3ae4f8f289

 

error is on this command:


Dim tmpOrder As Order = GetOrder(shippedOrders, DirectCast(e.DestDataItem.GetDataKeyValue("LORD"), Integer), DirectCast(e.DestDataItem.GetDataKeyValue("LLINE"), Integer))   



<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="sales_expidite.aspx.vb" Inherits="sales_sales_expidite" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="Header" Runat="Server">  
<script type="text/javascript">  
                <!--  
                    function onRowDropping(sender, args) {  
                        if (sender.get_id() == "<%=SalesEXPGrid.ClientID %>") {  
                            var node = args.get_destinationHtmlElement();  
                            if (!isChildOf('<%=grdShippedOrders.ClientID %>', node) && !isChildOf('<%=SalesEXPGrid.ClientID %>', node))  
                            {   
                                args.set_cancel(true);   
                            }   
                        }  
                        else  
                        {   
                            var node = args.get_destinationHtmlElement();   
                            if(!isChildOf('trashCan', node))  
                            {   
                                args.set_cancel(true);   
                            }  
                            else  
                            {  
                                if (confirm("Are you sure you want to delete this order?"))  
                                    args.set_destinationHtmlElement($get('trashCan'));  
                                else  
                                   args.set_cancel(true);   
                            }  
                        }  
                    }  
                      
                    function isChildOf(parentId, element)  
                    {  
                        while(element)  
                        {   
                            if (element.id && element.id.indexOf(parentId) > -1)  
                            {   
                                return true;  
                            }  
                            elementelement = element.parentNode;  
                        }  
                        return false;  
                    }  
                --> 
            </script> 
 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="PrimaryContent" Runat="Server">  
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="SalesEXPGrid">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="SalesEXPGrid" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 
    <asp:SqlDataSource ID="SalesEXPSQL" runat="server"   
        ConnectionString="<%$ ConnectionStrings:ERPLXFConnectionString %>"   
        SelectCommand="SELECT RTRIM(ECH.HCPO) as HCPO, RTRIM(ECL.LORD) as LORD, ECH.HCOMP, ECL.LLINE, ECL.LPROD, ECL.LDESC, ECL.LRDTE, LLL.LLSDTE, LLC.LCCRTN, LLH.LHPRON, LLL.LLSQTY, ECL.LQORD, ECH.HCUST, LCM.CMCDES, ECH.HNAME FROM ECL LEFT OUTER JOIN LLL ON ECL.LORD = LLL.LLORDN AND ECL.LLINE = LLL.LLOLIN LEFT OUTER JOIN ECH ON ECL.LORD = ECH.HORD LEFT OUTER JOIN LLC ON LLL.LLLOAD = LLC.LCLOAD AND ECL.LLINE = LLC.LCOLIN LEFT OUTER JOIN LLH ON LLL.LLLOAD = LLH.LHLOAD AND ECL.LLINE = LLH.LHTLNE LEFT OUTER JOIN LCM ON LLH.LHCARR = LCM.CMCARR WHERE (ECL.LRDTE &gt;= CONVERT (char(8), GETDATE(), 112) - 20000) ORDER BY ECL.LORD, ECL.LLINE"></asp:SqlDataSource> 
    <telerik:RadGrid ID="SalesEXPGrid" runat="server" ShowGroupPanel="True" GridLines="None" 
            DataSourceID="SalesEXPSQL" AllowFilteringByColumn="True" AllowPaging="True"   
                AllowSorting="True" PageSize="50" EnableHeaderContextMenu="True"

OnRowDrop

 

="grdPendingOrders_RowDrop"

 

 

>  
            <HeaderContextMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </HeaderContextMenu> 
            <MasterTableView GroupLoadMode="server" AutoGenerateColumns="False" GroupsDefaultExpanded="False" 
                             DataKeyNames="LORD,LLINE">  
                <Columns> 
                    <telerik:GridBoundColumn DataField="HCPO" HeaderText="PO No."   
                        SortExpression="HCPO" UniqueName="HCPO">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LORD" 
                        HeaderText="Order No." SortExpression="LORD" UniqueName="LORD">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LLINE" 
                        HeaderText="Line No." SortExpression="LLINE" UniqueName="LLINE">  
                    </telerik:GridBoundColumn>                      
                    <telerik:GridBoundColumn DataField="LPROD" HeaderText="Item No"   
                        SortExpression="LPROD" UniqueName="LPROD">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HCUST"   
                        HeaderText="Cust No" SortExpression="HCUST" UniqueName="HCUST">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HNAME" HeaderText="Cust Name"   
                        SortExpression="HNAME" UniqueName="HNAME">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="HCOMP" 
                        HeaderText="Company No." SortExpression="HCOMP" UniqueName="HCOMP">  
                    </telerik:GridBoundColumn>                      
                </Columns> 
                <ItemTemplate> 
                    <b>Cust No</b>:  
                    <asp:Label ID="Label12" runat="server" Text='<%# Eval("HCUST") %>'></asp:Label> 
                    <br /> 
                    <b>Cust Name</b>:  
                    <asp:Label ID="Label13" runat="server" Text='<%# Eval("HNAME") %>'></asp:Label> 
                    <br />                  
                    <b>PO No</b><asp:Label ID="Label1" runat="server" Text='<%# Eval("HCPO") %>'></asp:Label> 
                    <br /> 
                    <b>Order No</b><asp:Label ID="Label2" runat="server" Text='<%# Eval("LORD") %>'></asp:Label> 
                    <br /> 
                    <b>Line No</b><asp:Label ID="Label3" runat="server" Text='<%# Eval("LLINE") %>'></asp:Label> 
                    <br /> 
                    <b>Item No</b><asp:Label ID="Label4" runat="server" Text='<%# Eval("LPROD") %>'></asp:Label> 
                    <br /> 
                    <b>Desc</b><asp:Label ID="Label5" runat="server" Text='<%# Eval("LDESC") %>'></asp:Label> 
                    <br /> 
                    <b>Sched Ship</b><asp:Label ID="Label6" runat="server" Text='<%# Eval("LRDTE") %>'></asp:Label> 
                    <br /> 
                    <b>Ship Date</b>:  
                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("LLSDTE") %>'></asp:Label> 
                    <br /> 
                    <b>Ship Mthd</b>:  
                    <asp:Label ID="Label14" runat="server" Text='<%# Eval("CMCDES") %>'></asp:Label> 
                    <br /> 
                    <b>Tracking No</b>:  
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("LCCRTN") %>'></asp:Label> 
                    <br /> 
                    <b>Pro No</b>:  
                    <asp:Label ID="Label9" runat="server" Text='<%# Eval("LHPRON") %>'></asp:Label> 
                    <br /> 
                    <b>Qty Ship</b>:  
                    <asp:Label ID="Label10" runat="server" Text='<%# Eval("LLSQTY") %>'></asp:Label> 
                    <br /> 
                    <b>Qty Ord</b>:  
                    <asp:Label ID="Label11" runat="server" Text='<%# Eval("LQORD") %>'></asp:Label> 
                </ItemTemplate> 
                <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                       <GroupByFields> 
                            <telerik:GridGroupByField FieldName="LORD" /> 
                            <telerik:GridGroupByField FieldName="HCPO" /> 
                       </GroupByFields> 
                       <SelectFields> 
                            <telerik:GridGroupByField FieldName="HCOMP" HeaderText="Company No" /> 
                            <telerik:GridGroupByField FieldName="LORD" HeaderText="Order No" /> 
                            <telerik:GridGroupByField FieldName="HCPO" HeaderText="PO No" /> 
                       </SelectFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" AllowRowsDragDrop="True">  
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />   
            <ClientEvents OnRowDropping="onRowDropping" /> 
            </ClientSettings> 
            <FilterMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </FilterMenu> 
        </telerik:RadGrid> 
          
<telerik:RadGrid runat="server" AllowPaging="True" ID="grdShippedOrders" OnNeedDataSource="grdShippedOrders_NeedDataSource" 
                    AllowMultiRowSelection="true" PageSize="8" OnRowDrop="grdShippedOrders_RowDrop">  
                    <MasterTableView DataKeyNames="OrderId,PoNo,LineNo">  
                        <NoRecordsTemplate> 
                            <div style="height: 30px; cursor: pointer;">  
                                No items to view</div> 
                        </NoRecordsTemplate> 
                        <PagerStyle Mode="NumericPages" PageButtonCount="4" /> 
                    </MasterTableView> 
                    <ClientSettings AllowRowsDragDrop="True">  
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>  
                    </ClientSettings> 
                </telerik:RadGrid> 
         
</asp:Content> 
 
 


Imports System  
Imports System.Collections.Generic  
Imports System.Configuration  
Imports System.Data  
Imports System.Data.Common  
Imports System.Data.SqlClient  
Imports System.Web.UI  
Imports Telerik.Web.UI  
 
Partial Class sales_sales_expidite  
    Inherits System.Web.UI.Page  
 
    Protected Sub SalesEXPSQL_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SalesEXPSQL.Selecting  
        e.Command.CommandTimeout = 0  
    End Sub 
 
    Protected Property ShippedOrdersStore() As IList(Of Order)  
        Get 
            Try 
                Dim obj As Object = Session("ShippedOrders_VB")  
                If obj Is Nothing Then 
                    obj = New List(Of Order)()  
                    Session("ShippedOrders_VB") = obj  
                End If 
                Return DirectCast(obj, IList(Of Order))  
            Catch ex As Exception  
                Session("ShippedOrders_VB") = Nothing 
            End Try 
            Return New List(Of Order)  
        End Get 
        Set(ByVal value As IList(Of Order))  
            Session("ShippedOrders_VB") = value  
        End Set 
    End Property 
 
    Protected Sub grdShippedOrders_NeedDataSource(ByVal source As ObjectByVal e As GridNeedDataSourceEventArgs)  
        grdShippedOrders.DataSource = ShippedOrdersStore  
    End Sub 
 
    Private Shared Function GetOrder(ByVal ordersToSearchIn As IEnumerable(Of Order), ByVal orderId As IntegerByVal lineNo As IntegerAs Order  
        For Each order As Order In ordersToSearchIn  
            If order.OrderId = orderId Then 
                If order.LineNo = lineNo Then 
                    Return order  
                End If 
            End If 
        Next 
        Return Nothing 
    End Function 
 
    Protected Sub grdShippedOrders_RowDrop(ByVal sender As ObjectByVal e As GridDragDropEventArgs)  
        If Not String.IsNullOrEmpty(e.HtmlElement) AndAlso e.HtmlElement = "trashCan" Then 
            Dim shippedOrders As IList(Of Order)  
            shippedOrders = ShippedOrdersStore  
            Dim deleted As Boolean = False 
 
            For Each draggedItem As GridDataItem In e.DraggedItems  
                Dim tmpOrder As Order = GetOrder(shippedOrders, DirectCast(draggedItem.GetDataKeyValue("LORD"), Integer), DirectCast(draggedItem.GetDataKeyValue("LLINE"), Integer))  
 
                If tmpOrder IsNot Nothing Then 
                    deleted = True 
                    shippedOrders.Remove(tmpOrder)  
                End If 
            Next 
            ShippedOrdersStore = shippedOrders  
            grdShippedOrders.Rebind()  
        End If 
    End Sub 
 
    Protected Sub grdPendingOrders_RowDrop(ByVal sender As ObjectByVal e As GridDragDropEventArgs)  
        If String.IsNullOrEmpty(e.HtmlElement) Then 
            If e.DraggedItems(0).OwnerGridID = SalesEXPGrid.ClientID Then 
                ' items are drag from pending to shipped grid   
                If (e.DestDataItem Is Nothing AndAlso ShippedOrdersStore.Count = 0) OrElse (e.DestDataItem IsNot Nothing AndAlso e.DestDataItem.OwnerGridID = grdShippedOrders.ClientID) Then 
                    Dim shippedOrders As IList(Of Order)  
                    'Dim pendingOrders As IList(Of Order)  
 
                    shippedOrders = ShippedOrdersStore  
                    'pendingOrders = PendingOrdersStore  
 
                    Dim destinationIndex As Int32 = -1  
                    If (e.DestDataItem IsNot NothingThen 
                        Dim order As Order = GetOrder(shippedOrders, DirectCast(e.DestDataItem.GetDataKeyValue("LORD"), Integer), DirectCast(e.DestDataItem.GetDataKeyValue("LLINE"), Integer))  
 
                        destinationIndex = IIf(order IsNot Nothing, shippedOrders.IndexOf(order), -1)  
                    End If 
 
                    For Each draggedItem As GridDataItem In e.DraggedItems  
                        Dim tmpOrder As Order = GetOrder(shippedOrders, DirectCast(e.DestDataItem.GetDataKeyValue("LORD"), Integer), DirectCast(e.DestDataItem.GetDataKeyValue("LLINE"), Integer))  
 
                        If tmpOrder IsNot Nothing Then 
                            If destinationIndex > -1 Then 
                                shippedOrders.Insert(destinationIndex, tmpOrder)  
                            Else 
                                shippedOrders.Add(tmpOrder)  
                            End If 
                            'pendingOrders.Remove(tmpOrder)  
                        End If 
                    Next 
                    ShippedOrdersStore = shippedOrders  
                    grdShippedOrders.Rebind()  
                End If 
            End If 
        End If 
    End Sub 
 
 
 
    Protected Class Order  
        Private _companyName As String 
        Private _customerId As Integer 
        Private _orderId As Integer 
        Private _poNo As String 
        Private _lineNo As Integer 
        Private _itemNo As String 
        Private _desc As String 
        Private _schdShip As Integer 
        Private _shipDate As Integer 
        Private _shipMth As String 
        Private _trackingNo As String 
        Private _proNo As String 
        Private _qtyShip As String 
        Private _qtyOrd As String 
 
        Public Sub New(ByVal orderId As IntegerByVal customerId As StringByVal companyName As StringByVal poNo As StringByVal lineNo As IntegerByVal itemNo As StringByVal desc As StringByVal schdShip As IntegerByVal shipDate As IntegerByVal shipMth As StringByVal trackingNo As StringByVal proNo As StringByVal qtyShip As StringByVal qtyOrd As String)  
            _orderId = orderId  
            _customerId = customerId  
            _companyName = companyName  
            _poNo = poNo  
            _lineNo = lineNo  
            _itemNo = itemNo  
            _desc = desc  
            _schdShip = schdShip  
            _shipDate = shipDate  
            _shipMth = shipMth  
            _trackingNo = trackingNo  
            _proNo = proNo  
            _qtyShip = qtyShip  
            _qtyOrd = qtyOrd  
 
        End Sub 
 
        Public ReadOnly Property Company() As String 
            Get 
                Return _companyName  
            End Get 
        End Property 
        Public ReadOnly Property CustomerID() As String 
            Get 
                Return _customerId  
            End Get 
        End Property 
        Public ReadOnly Property PoNo() As String 
            Get 
                Return _poNo  
            End Get 
        End Property 
        Public ReadOnly Property OrderId() As Integer 
            Get 
                Return _orderId  
            End Get 
        End Property 
        Public ReadOnly Property LineNo() As Integer 
            Get 
                Return _lineNo  
            End Get 
        End Property 
        Public ReadOnly Property ItemNo() As String 
            Get 
                Return _itemNo  
            End Get 
        End Property 
        Public ReadOnly Property Desc() As String 
            Get 
                Return _desc  
            End Get 
        End Property 
        Public ReadOnly Property SchdShip() As Integer 
            Get 
                Return _schdShip  
            End Get 
        End Property 
        Public ReadOnly Property ShipDate() As Integer 
            Get 
                Return _shipMth  
            End Get 
        End Property 
        Public ReadOnly Property ShipMth() As String 
            Get 
                Return _shipMth  
            End Get 
        End Property 
        Public ReadOnly Property TrackingNo() As String 
            Get 
                Return _trackingNo  
            End Get 
        End Property 
        Public ReadOnly Property ProNo() As String 
            Get 
                Return _proNo  
            End Get 
        End Property 
        Public ReadOnly Property QtyShip() As String 
            Get 
                Return _qtyShip  
            End Get 
        End Property 
        Public ReadOnly Property QtyOrd() As String 
            Get 
                Return _qtyOrd  
            End Get 
        End Property 
    End Class 
End Class 
 
 
 
0
Carl
Telerik team
answered on 18 Oct 2009, 08:19 AM
Hi Bradley,

Could you please open a formal support ticket regarding this issue? This way you could provide all your information that you provided here along with any other details we might need in a working project (zipped up) and we could take a better look at it.

Sincerely yours,
Carl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
bradley baker
Top achievements
Rank 1
Answers by
bradley baker
Top achievements
Rank 1
Schlurk
Top achievements
Rank 2
Carl
Telerik team
Share this question
or