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

onClientContextMenuItemClicking Fires Multiple Times

4 Answers 75 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marbry
Top achievements
Rank 1
Marbry asked on 19 Jan 2012, 03:58 PM
What is says.  It's not happening under all circumstances, but when I add a new node and then immediately go to add a child of that it fires the event exactly 4 times for one click.

Of course this causes problems.  I've tried ignoring the extra calls, but it causes a problem because it still interrupts the startEdit() process which it depends on to then connect to the code behind.

4 Answers, 1 is accepted

Sort by
0
Marbry
Top achievements
Rank 1
answered on 20 Jan 2012, 03:44 PM
The problem is that this is occurring on a selection that lets the user add a node, so instead of one new node you instantly get four.

I would prefer to get it to stop firing 4 times in the first place, but I'm trying to work around it for now by letting the first one be created then kicking it out of the additional calls based on time.

This works to the point that a single node is created and startEdit() is called on it.  But once I enter a value and move off it, there is an error thrown on the postback because it says there are two instances of the same control.

When I look at the Request.Params on the postback ALL the menu items appear to be duplicated like so.

ctl00_MainContent_tkTree_AddMenu_ClientState=&
ctl00_MainContent_tkTree_AddMenu_ClientState=&
ctl00_MainContent_tkTree_AddMenuDisabled_ClientState=&
ctl00_MainContent_tkTree_AddMenuDisabled_ClientState=&
ctl00_MainContent_tkTree_AddMenuNoDisabled_ClientState=&
ctl00_MainContent_tkTree_AddMenuNoDisabled_ClientState=&
ctl00_MainContent_tkTree_EditMenu_ClientState=&
ctl00_MainContent_tkTree_EditMenu_ClientState=&

The error is thrown on AddMenu, but I think that's just because it's the first one.
0
Marbry
Top achievements
Rank 1
answered on 20 Jan 2012, 08:30 PM
Adding a clear() to the context menus collection at the top of the function took care of the duplicate menu issue.  Looks like it created two postbacks in a row that duplicated the menu population call.  That appears to effectively be working for the moment, at least it should be transparent to the user.

I would still like to determine and eliminate the source of the multiple event firing in the first place though if anyone has any ideas?
0
Plamen
Telerik team
answered on 23 Jan 2012, 12:54 PM
Hello Marbry,

I have tested the Context menu demo to add a new node and then click the menu but it was thrown only one time. Here is the video of my test. Would you please let me know what else should I do in order to reproduce the issue?


All the best,
Plamen Zdravkov
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
0
Marbry
Top achievements
Rank 1
answered on 23 Jan 2012, 03:34 PM
Yes, it only occurs for me under a specific set of circumstances.  I'll see if I can put a small example together that will reproduce the behavior.
Tags
TreeView
Asked by
Marbry
Top achievements
Rank 1
Answers by
Marbry
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or