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

Event only fires first time with button inside ItemTemplate

3 Answers 107 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 12 Dec 2013, 08:30 AM
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!

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 17 Dec 2013, 09:08 AM
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.
0
Daniel
Top achievements
Rank 1
answered on 17 Dec 2013, 04:40 PM
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
0
Plamen
Telerik team
answered on 18 Dec 2013, 10:36 AM
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.
Tags
OrgChart
Asked by
Daniel
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or