Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
87 views
Hi,

I am trying to add Drag and Drop Functionality in client side with Ajax Post Request to the server:

<telerik:RadTreeView runat="server" ID="rdtrOrganization" Height="450" BorderWidth="0" OnNodeExpand="groupsTree_NodeExpand" OnClientNodeClicked="ClientNodeClicking"       OnClientNodeDropping ="onNodeDropping" EnableDragAndDrop="true"                     EnableDragAndDropBetweenNodes="true"          Width="100%" Skin="Web20" CheckBoxes="false" CausesValidation="false" TriStateCheckBoxes="false"></telerik:RadTreeView>

onNodeDropping client function:
01.
         
function onNodeDropping(sender, args) {           
         var sourceNode = args.get_sourceNode();
         var destinationNode = args.get_destNode();
         var nodeType = sourceNode._attributes.getAttribute('<%=k_TreeNodeTypeAttribute%>');
         if (nodeType === "SP" || nodeType === "Server" || nodeType === "Company") {
             return;
         }           
         var dest = args.get_destNode();
         if (dest) {
             $telerik.$.ajax({
                 type: "POST",
                 url: "OrganizationManagement.aspx/MoveTeam",
                 data: "{'sourceID': '" + sourceNode._attributes._data.Guid + "','destinationID': '" + destinationNode._attributes._data.Guid + "'}",
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: function (response) {            
                     clientSideEdit(sender, args);                                               
                 },
                 error: function (xhr, err) {
 
                 }
             });              
 
         }
     }
                          

Function clientSideEdit:

function clientSideEdit(sender, args) {
            var destinationNode = args.get_destNode();
 
            if (destinationNode) {
                var firstTreeView = $find('<%= rdtrOrganization.ClientID %>');               
 
                firstTreeView.trackChanges();
                 
                var sourceNodes = args.get_sourceNodes();
                var dropPosition = args.get_dropPosition();
 
                //Needed to preserve the order of the dragged items
                if (dropPosition == "below") {
                    for (var i = sourceNodes.length - 1; i >= 0; i--) {
                        var sourceNode = sourceNodes[i];
                        sourceNode.get_parent().get_nodes().remove(sourceNode);
 
                        insertAfter(destinationNode, sourceNode);
                    }
                }
                else {
                    for (var i = 0; i < sourceNodes.length; i++) {
                        var sourceNode = sourceNodes[i];
                        sourceNode.get_parent().get_nodes().remove(sourceNode);
 
                        if (dropPosition == "over")
                            destinationNode.get_nodes().add(sourceNode);
                        if (dropPosition == "above")
                            insertBefore(destinationNode, sourceNode);
                    }
                }
                destinationNode.set_expanded(true);
                firstTreeView.commitChanges();               
            }
        }
 
        function insertAfter(destinationNode, sourceNode) {
            var destinationParent = destinationNode.get_parent();
            var index = destinationParent.get_nodes().indexOf(destinationNode);
            destinationParent.get_nodes().insert(index + 1, sourceNode);
        }
 
        function insertBefore(destinationNode, sourceNode) {
            var destinationParent = destinationNode.get_parent();
            var index = destinationParent.get_nodes().indexOf(destinationNode);
            destinationParent.get_nodes().insert(index, sourceNode);
        }

If I will not use the ajax call the function: clientSideEdit will work.

What I need to change that it will work with the ajax call.

please help me it very urgent.

Thanks in advance.
Kate
Telerik team
 answered on 25 Mar 2014
1 answer
104 views
I have a custom template to handle true/false data points. The custom filter is a simple dropdown with a null/true/false values.

I have a client OnCommand function, and when I filter from any of my regular columns the function fires normally, however, when I filter from my custom column the page post back and the filter works, but the OnCommand function never fires. Here is my OnCommand function and my custom template:


function GridCommand(grid, args) {
    var command = args.get_commandName();
    console.log(command);
    if (command == "Filter") {
        console.log("Filtering data...");
    }
};

        private class CheckColumnTemplate : GridTemplateColumn
        {
            protected DropDownList DDl;

            protected override void SetupFilterControls(TableCell cell)
            {
                base.SetupFilterControls(cell);
                cell.Controls.RemoveAt(0);
                DDl = new DropDownList();
                DDl.EnableViewState = true;
                DDl.ViewStateMode = ViewStateMode.Enabled;
                DDl.ID = "ddl_" + this.DataField;
                ListItem blankItem = new ListItem("", "");
                ListItem trueItem = new ListItem("True", "1");
                ListItem falseItem = new ListItem("False", "0");
                DDl.Items.Add(blankItem);
                DDl.Items.Add(trueItem);
                DDl.Items.Add(falseItem);
                DDl.AutoPostBack = true;
                DDl.SelectedIndexChanged += new EventHandler(FilterCombo_SelectedIndexChanged);
                cell.Controls.AddAt(0, DDl);
                cell.Controls.RemoveAt(1);
                DDl.DataTextField = this.DataField;
                DDl.DataValueField = this.DataField;
            }

            protected void FilterCombo_SelectedIndexChanged(object sender, EventArgs e)
            {
                DropDownList DDl = (DropDownList)sender;
                GridFilteringItem filterItem = (GridFilteringItem)DDl.NamingContainer;
                string filterType = DDl.SelectedValue == "" ? "NoFilter" : "EqualTo";
                filterItem.FireCommandEvent("Filter", new Pair(filterType, DDl.NamingContainer.ToString()));
            }

            protected override void SetCurrentFilterValueToControl(TableCell cell)
            {
                ((DropDownList)cell.Controls[0]).SelectedValue = this.CurrentFilterValue;
            }

            protected override string GetCurrentFilterValueFromControl(TableCell cell)
            {
                string currentValue = ((DropDownList)cell.Controls[0]).SelectedValue;
                this.CurrentFilterFunction = currentValue == "" ? GridKnownFunction.NoFilter : GridKnownFunction.EqualTo;
                return currentValue;
            }
        }






Viktor Tachev
Telerik team
 answered on 25 Mar 2014
1 answer
74 views
hello, you have a lot of examples, but which control is your own Menu or Tree or Panelbar which you use yourself for your examples.
..attached is the picture.
Kate
Telerik team
 answered on 25 Mar 2014
1 answer
80 views
Hi,

I want to use the Telerik Grid for SharePoint 2013 web parts which are going to be viewed in all major browsers as well as all the mobile devices like iOS, Android, Windows Phones etc.

Can any one please tell me how can I use the Telerik grid for my application. I am using ASP.NET Gridview in my application which needs to be shown on the mobile as well as desktop devices.

Thanks in advance.
Marin
Telerik team
 answered on 25 Mar 2014
0 answers
50 views
We want to create a 4 level grid to display the following information
Level1: Projects – every project number is unique
Level 2: The orders that belong to the project – The orders for every project starts with order no 0001. There could be many orders with the same number (e.g. 0001) but only one order 0001 for each project. Project plus order number is unique
Level3: The Line Items within an order. Again a line item 0001 will appear in every order. Project + Order No + line Item is unique
Level4: The Release Note numbers for each Line Item. There could be many Release not numbers for each Project, Order No, Line Item Combination.
Question:
How should the Master and detail keys be structured for each level.
Lee'Roy
Top achievements
Rank 1
 asked on 25 Mar 2014
2 answers
225 views
Hi
I'm trying to use the RadTreeView like this:
the treeView takes its data from a list.
When I press on a node, I get a value from it (& then later I can call function base on the value)

I have a hard time to set value into the treeView

I set the List like that:
vb.NET:
01.Friend Class SiteDataItem
02.     Private text1 As String
03.     Private id1 As Integer
04.     Private parentId1 As Integer
05.     Private report_id1 As String
06. 
07.     Public Property Text() As String
08.         Get
09.             Return text1
10.         End Get
11.         Set(ByVal value As String)
12.             text1 = value
13.         End Set
14.     End Property
15. 
16. 
17.     Public Property ID() As Integer
18.         Get
19.             Return id1
20.         End Get
21.         Set(ByVal value As Integer)
22.             id1 = value
23.         End Set
24.     End Property
25. 
26.     Public Property ParentID() As Integer
27.         Get
28.             Return parentId1
29.         End Get
30.         Set(ByVal value As Integer)
31.             parentId1 = value
32.         End Set
33.     End Property
34. 
35.     Public Property Report_ID() As String
36.         Get
37.             Return report_id1
38.         End Get
39.         Set(ByVal value As String)
40.             report_id1 = value
41.         End Set
42.     End Property
43. 
44.     Public Sub New(ByVal id As Integer, ByVal parentId As Integer, ByVal text As String, Optional ByVal report_id1 As String = "99")
45.         Me.id1 = id
46.         Me.parentId1 = parentId
47.         Me.text1 = text
48.         Me.report_id1 = Report_ID
49.         
50.     End Sub
51.      
52.      
53.     '--------- Constractor
54.     Public Sub New(ByVal id As Integer, ByVal parentId As Integer, ByVal text As String, Optional ByVal report_id1 As String = "99")
55.         Me.id1 = id
56.         Me.parentId1 = parentId
57.         Me.text1 = text
58.         Me.report_id1 = Report_ID
59.        
60.     End Sub
61. End Class
62.  
63. '=======
64.  
65.  
66.    Private Sub BindToIEnumerable(ByVal treeView As RadTreeView)
67.     Dim siteData As New List(Of SiteDataItem)()
68. 
69.     siteData.Add(New SiteDataItem(1, 0, "Location"))
70.     siteData.Add(New SiteDataItem(2, 0, "Hobbies"))
71.     siteData.Add(New SiteDataItem(3, 1, "func 1", "101"))
72.     siteData.Add(New SiteDataItem(4, 1, "func 2", "102"))
73.     siteData.Add(New SiteDataItem(5, 2, "func 4", "103"))
74.     siteData.Add(New SiteDataItem(6, 2, " func 1" , "104"))
75. 
76. 
77.     treeView.DataTextField = "Text"
78.     treeView.DataFieldID = "ID"
79.     treeView.DataFieldParentID = "ParentID"
80.     treeView.DataValueField = "Report_ID"
81.     treeView.DataSource = siteData
82.     treeView.DataBind()
83. 
84.     
85. 
86. End Sub

As you see, I insert a value,text,iD &parent_id into the RadTreeView,   [line 77-80]
All is built well : the text,ID & Parent_id. But when I try to get the value field it shows me null:


Protected Sub treeView_SideMenu_NodeClick(sender As Object, e As RadTreeNodeEventArgs) Handles treeView_SideMenu.NodeClick
 
 
       Session("funcID") = e.Node.Value  'Unfortunately return NULL
 
 
 
   End Sub

p.s
I Must use the "Value" Property and not "by text" ,because I've identical text menu





Princy
Top achievements
Rank 2
 answered on 25 Mar 2014
1 answer
67 views
Hi,

In prior versions (prior to Q1 2014) the TreeList control would work with Height = "100%", now it downsizes to just 1 row.

Is this by design or a bug - any work around for it?

Regards

Jon
Jon
Top achievements
Rank 1
 answered on 25 Mar 2014
1 answer
52 views
Hello,
I want to set only preview mode with print option only.
Rumen
Telerik team
 answered on 25 Mar 2014
1 answer
112 views
i am programatically create radeditor and set it content and convert into pdf below is the code. but give following error
RadEditor radEdit = new RadEditor();
                radEdit.SkinID = "DefaultSetOfTools";
                radEdit.ContentFilters = EditorFilters.DefaultFilters;
                radEdit.ContentFilters = EditorFilters.PdfExportFilter;
               radEdit.Content= MakeTable();
                radEdit.ExportSettings.OpenInNewWindow=true;
               radEdit.ExportToPdf();

 ERROR : at Telerik.Web.UI.RadEditor.ExportToPdf() give error  Object reference not set to an instance of an object.

please give tell me how do i reslove this issue. ASAP.
Ianko
Telerik team
 answered on 25 Mar 2014
1 answer
57 views
Hello

Is there a way to create layouts like Sitefinity allow you too?  What Telerik controls would I use?  Is there an example?

Thanks,

Example of what I am looking for:
http://www.sitefinity.com/product/drag-drop-layouts
Ivan Zhekov
Telerik team
 answered on 25 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?