Event only fires first time with button inside ItemTemplate

4 posts, 0 answers
  1. Daniel
    Daniel avatar
    7 posts
    Member since:
    May 2013

    Posted 12 Dec 2013 Link to this post

    Hi!

    I have a problem with events not triggered the second time in RadOrgChart.
    In my project I need both to add and remove nodes. Adding nodes works really nice with the drag and drop functionality, but removing is more complicated. To solve this I added an asp:Button inside the ItemTemplate that fires the event of removing a node. This works fine when removing one node. But when I try to remove the next node the event will never get fired - what happens is that I get a postback (because of the button) but it never triggers the event. On the other hand, if I again try to press the button, the event will be called. I am working with dynamically created data so to be certain that the behaviour is not depending on this I tried changing the RadOrgChart to an asp:Repeater to test the behaviour, but this case proved to work - the remove event was called every time when using the Repeater. This leads me to believe there is some sort of bug with RadOrgChart. To be perfectly clear about what I did, I'll give you the aspx code and the situation step by step:

    1. Page is loaded. I press the button of one of the nodes and the delete event is called, which removes this node.
    2. I press the button of another node (because my first node is deleted) and I get a postback, but the event is not fired.
    3. I press the button of the same node as (2) and I get a postback AND the event gets called.

    <telerik:RadOrgChart runat="server" ID="RadOrgChart1" DataTextField="Name" DataFieldID="ID" DataFieldParentID="ParentID">
        <ItemTemplate>
            <asp:Button runat="server" ID="ButtonRemoveBox" OnClick="ButtonRemoveBox_Click" />
        </ItemTemplate>
    </telerik:RadOrgChart>

    Is this a know bug or what could I do to trigger the event? (I could of course do a Response.Redirect() in my event to the same page but that is a nasty solution)
    Thanks for helping!
  2. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 17 Dec 2013 Link to this post

    Hi,

    In such scenario we recommend using the approach from this on-line demo instead of using asp :button.

    Hope this information will be helpful. 

    Regards,
    Plamen
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    7 posts
    Member since:
    May 2013

    Posted 17 Dec 2013 Link to this post

    Hi and thanks for the reply.

    I used this demo from the start but I wanted to get away from the javascript clutter (I have already a lot of javascript code in the page myself), so I decided to make use of asp:Buttons instead. I guess I have to go back to the original design.

    It would anyway be interesting to know the reason behind the behaviour, and to know if it will be fixed later on?

    Regards
    Daniel
  5. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 18 Dec 2013 Link to this post

    Hello Daniel,

    Unfortunately this is a limitation of RadOrgChart that is caused by the specific way it is designed to render its nodes. We are aware of the issue but at the moment could not commit on any time for its fixing.

    Regards,
    Plamen
    Telerik
    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 the blog feed now.
Back to Top