NodeDrop not firing

6 posts, 0 answers
  1. Justin
    Justin avatar
    13 posts
    Member since:
    Feb 2011

    Posted 27 Feb 2012 Link to this post

    I have an orgchart inside of a content place holder for a page with a master page:

    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <telerik:RadOrgChart ID="RadOrgChart1" runat="server" EnableCollapsing="true" EnableDragAndDrop="true">
        </telerik:RadOrgChart>
    </asp:Content>

    The data I'm using to populate the orgchart is coming from a web service - so on page load I attach the nodedrop event handler, grab the resource data which I then translate into a data table, then I do my data binding:

    protected void Page_Load(object sender, EventArgs e)
        {
            RadOrgChart1.NodeDrop += RadOrgChart1_NodeDrop;
            GetResources();
            LoadEmployees();
     
            RadOrgChart1.RenderedFields.ItemFields.Add(new Telerik.Web.UI.OrgChartRenderedField() { DataField = "Position" });
     
            RadOrgChart1.DataSource = employees;
            RadOrgChart1.DataFieldID = "EmployeeID";
            RadOrgChart1.DataFieldParentID = "ReportsTo";
            RadOrgChart1.DataTextField = "FullName";
            RadOrgChart1.DataImageUrlField = "ImageUrl";
            RadOrgChart1.DataBind();
        }

    The orgchart loads as expected and looks great.  When I drag and drop an item and set up break points, the page load events are hit but not the nodedrop events.  I'm not sure if there is something special I have to deal with due to the master page or if I'm just missing something basic in the page life cycle.  The way I'm looking at this I'm essentially doing it exactly as the demo suggests:  http://demos.telerik.com/aspnet-ajax/orgchart/examples/draganddropsimplebinding/defaultcs.aspx 

    One additional piece of information is that the script manager is located on the master page - not sure why that should cause a problem.
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 01 Mar 2012 Link to this post

    Hi Vol,

    I created a sample project and reproduced the described issue. The fix will be available next week in our latest internal build. For now I prepared a workaround for you -  please review the attachment.
    The problematic behavior is caused by submitting the page with EventTarget, which set to ClientID of the RadOrgChart control. To fire the RaisePostBackEvent (in particular NodeDrop event) of the control,  the EventTarget should be set to the UniqueID of the RadOrgChart.

    Your points have been updated for the report.

    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Justin
    Justin avatar
    13 posts
    Member since:
    Feb 2011

    Posted 01 Mar 2012 Link to this post

    Thanks for the work around Peter, did the trick.
  5. Ahmad
    Ahmad avatar
    2 posts
    Member since:
    Aug 2011

    Posted 20 Mar 2012 Link to this post

    Hi I am running into exact same problem but the solution provided is not working. I downloaded  the latest internal build but it seems like the issue is still not fixed (File Version: 2012.1.320.40). Script manager is in master page.

    I tried both roc.ClientID and roc.UniqueID. Postback does happen but does not fire the NodeDrop event.

    This is what I have:
    CS:
                roc.DataTextField = "Name";
                roc.DataFieldID = "Id";
                roc.DataFieldParentID = "ReportsToId";
                roc.DataBind();
                this.roc.NodeDrop += new OrgChartNodeDropEventHandler(roc_NodeDrop);

    //I added this as your example suggests.
                var scriptManager = Page.ClientScript;
                scriptManager.RegisterClientScriptBlock(this.GetType(), "key", "var _uniqueID = '" + roc.ClientID + "';", true);


    ASPX:
    <telerik:RadOrgChart runat="server" ID="roc" EnableDragAndDrop="true" EnableCollapsing="true">
                <ItemTemplate>I have a template here...</ItemTemplate>
    </telerik:RadOrgChart>
    <script type="text/javascript">

                Telerik.Web.UI.RadOrgChart.prototype.postback = function (postBackArgs) {

                    var serializedArguments = Sys.Serialization.JavaScriptSerializer.serialize(postBackArgs);
    //                alert(serializedArguments.toString());
                    __doPostBack(_uniqueID, serializedArguments.toString());
                };
        
        </script>

    Thanks.
  6. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 21 Mar 2012 Link to this post

    Hi Ahmad,

    I tested the drag and drop functionality with version 2012.2.320.40 and everything works fine (there is no need to apply the workaround).

    I created a sample project from the provided code and found out what is causing the incorrect behaviour. In the following line you pass the client ID of the RadOrgChart, it should be the unique ID:

    scriptManager.RegisterClientScriptBlock(this.GetType(), "key", "var _uniqueID = '" + roc.ClientID + "';", true);

    The correct one is:

    scriptManager.RegisterClientScriptBlock(this.GetType(), "key", "var _uniqueID = '" + roc.UniqueID+ "';", true);


    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. Ahmad
    Ahmad avatar
    2 posts
    Member since:
    Aug 2011

    Posted 22 Mar 2012 Link to this post

    Thanks, I got it to work.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017