Sometimes there are duplicate sub menu items created for no apparent reason. Sometimes it works fine.
Say there are 3 submenu items under a parent, select one of those, move off it, go back to it a second later and those same 3 subitems have been repeated usually 1-3 times so that there are now 6-12 items under the parent. It's also always the full set of subitems that are repeated, it's never just 1 or 2 out of the 3.
It seems to be somewhat random. The menu is created in code and I've confirmed that code is ONLY being hit on the initial page load and not any postbacks. The only other interaction in code with the menu is to enable or disable certain items depending on what the user had selected.
Other than the client menu item click handler, all code referencing the menu is on the server side.
Say there are 3 submenu items under a parent, select one of those, move off it, go back to it a second later and those same 3 subitems have been repeated usually 1-3 times so that there are now 6-12 items under the parent. It's also always the full set of subitems that are repeated, it's never just 1 or 2 out of the 3.
It seems to be somewhat random. The menu is created in code and I've confirmed that code is ONLY being hit on the initial page load and not any postbacks. The only other interaction in code with the menu is to enable or disable certain items depending on what the user had selected.
Other than the client menu item click handler, all code referencing the menu is on the server side.
10 Answers, 1 is accepted
0
Hello Marbry,
Can you please provide some more information on your scenario - for example some markup or code behind how you create the menu would be very helpful so we could try to reproduce the issue and inspect it locally? Does this happen in every browser and do you use VB or C# language? In case you use VB you could check is if you have attached the event handler in the markup as well as described here.
Kind regards,
Kate
the Telerik team
Can you please provide some more information on your scenario - for example some markup or code behind how you create the menu would be very helpful so we could try to reproduce the issue and inspect it locally? Does this happen in every browser and do you use VB or C# language? In case you use VB you could check is if you have attached the event handler in the markup as well as described here.
Kind regards,
Kate
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
Marbry
Top achievements
Rank 1
answered on 29 Aug 2011, 02:18 PM
Here is the code to create and assign the menu items. This is in C#.
It is only used in IE, so I haven't tested in other browsers.
It is only used in IE, so I haven't tested in other browsers.
static
RadMenuItem save =
new
RadMenuItem(
"Save"
);
static
RadMenuItem cancel =
new
RadMenuItem(
"Cancel"
);
static
RadMenuItem delete =
new
RadMenuItem(
"Delete"
);
static
RadMenuItem create =
new
RadMenuItem(
"Create"
);
static
RadMenuItem print =
new
RadMenuItem(
"Print"
);
static
RadMenuItem printw =
new
RadMenuItem(
"Print With Attachments"
);
static
RadMenuItem printwo =
new
RadMenuItem(
"Print Without Attachments"
);
static
RadMenuItem searchhead =
new
RadMenuItem(
"Search"
);
static
RadMenuItem clear =
new
RadMenuItem(
"Clear for Search"
);
static
RadMenuItem search =
new
RadMenuItem(
"Search on Current Values"
);
static
RadMenuItem endsearch =
new
RadMenuItem(
"End Search"
);
static
RadMenuItem pages =
new
RadMenuItem(
"Select Page"
);
static
RadMenuItem injury =
new
RadMenuItem(
"Incident"
);
static
RadMenuItem report =
new
RadMenuItem(
"Report"
);
static
RadMenuItem chart =
new
RadMenuItem(
"Chart"
);
static
RadMenuItem updateref =
new
RadMenuItem(
"Update Lists"
);
menu.Items.Add(save);
menu.Items.Add(cancel);
cancel.Visible =
false
;
menu.Items.Add(create);
menu.Items.Add(delete);
menu.Items.Add(print);
print.Items.Add(printw);
print.Items.Add(printwo);
searchhead.Items.Add(clear);
searchhead.Items.Add(search);
searchhead.Items.Add(endsearch);
menu.Items.Add(searchhead);
pages.Items.Add(report);
pages.Items.Add(chart);
pages.Items.Add(updateref);
menu.Items.Add(pages);
0
Hello Marbry,
Thanks for the code provided but unfortunately it is not enough to be able to reproduce the issue. Can you please open a support ticket and send us a simplified runnable project where we can inspect it locally since there may be different reasons for the behaviour that you encounter?
Kind regards,
Kate
the Telerik team
Thanks for the code provided but unfortunately it is not enough to be able to reproduce the issue. Can you please open a support ticket and send us a simplified runnable project where we can inspect it locally since there may be different reasons for the behaviour that you encounter?
Kind regards,
Kate
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
Marbry
Top achievements
Rank 1
answered on 12 Sep 2011, 07:41 PM
Here is a small sample project with the code used as it is in mine.
I can't tell you exactly how to reproduce it, I'm not sure what's causing it and it doesn't occur every time.
http://www.mediafire.com/file/2qrxxf94epxlw7p/RadMenuTest.zip
I can't tell you exactly how to reproduce it, I'm not sure what's causing it and it doesn't occur every time.
http://www.mediafire.com/file/2qrxxf94epxlw7p/RadMenuTest.zip
0
Hi Marbry,
After excluding some files that were causing errors and thus preventing running of the project I could test your code. However, using the latest version of the Telerik controls I am not able to replicate the issue that you describe. Please take a look at the attached page and let me know how if goes from your side. Please try also to modify it in a way that it demonstrates the issue so we could help you out.
All the best,
Kate
the Telerik team
After excluding some files that were causing errors and thus preventing running of the project I could test your code. However, using the latest version of the Telerik controls I am not able to replicate the issue that you describe. Please take a look at the attached page and let me know how if goes from your side. Please try also to modify it in a way that it demonstrates the issue so we could help you out.
All the best,
Kate
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Hello Marbry,
Here is an image (I forgot to attach) that demonstrates the menu that I get using the code provided in my previous post.
Best wishes,
Kate
the Telerik team
Here is an image (I forgot to attach) that demonstrates the menu that I get using the code provided in my previous post.
Best wishes,
Kate
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Marbry
Top achievements
Rank 1
answered on 15 Sep 2011, 02:23 PM
Unfortunately it's not a consistent condition. I'm unable to reliably recreate it and determine the cause, but that is the code I'm using to create it. I thought it might be realated to the order that I added the child items, but I switched that around and it still happened.
When it does occur, it seems to be right after a post back occurs, but I've confirmed that it's not anything obvious like the menu creation code being run multiple times. It's odd that the number of times it's repeated seems to be related to how many menu items there are, that might be a clue.
The only code I have modifying the menu after it's initially built is to just enable/disable certain items.
When it does occur, it seems to be right after a post back occurs, but I've confirmed that it's not anything obvious like the menu creation code being run multiple times. It's odd that the number of times it's repeated seems to be related to how many menu items there are, that might be a clue.
The only code I have modifying the menu after it's initially built is to just enable/disable certain items.
0
Hi Marbry,
I could finally reproduce the issue that you describe and indeed it is a very strange behavior. I modified a bit your code, tested it and it seems to be working fine now. Please give it a try using the following modifications:
Kind regards,
Kate
the Telerik team
I could finally reproduce the issue that you describe and indeed it is a very strange behavior. I modified a bit your code, tested it and it seems to be working fine now. Please give it a try using the following modifications:
public
static
void
PopulateMenu(RadMenu menu,
string
callingPage)
{
RadMenuItem save =
new
RadMenuItem(
"Save"
);
RadMenuItem cancel =
new
RadMenuItem(
"Cancel"
);
RadMenuItem delete =
new
RadMenuItem(
"Delete"
);
RadMenuItem create =
new
RadMenuItem(
"Create"
);
RadMenuItem print =
new
RadMenuItem(
"Print"
);
RadMenuItem printw =
new
RadMenuItem(
"Print With Attachments"
);
RadMenuItem printwo =
new
RadMenuItem(
"Print Without Attachments"
);
RadMenuItem searchhead =
new
RadMenuItem(
"Search"
);
RadMenuItem clear =
new
RadMenuItem(
"Clear for Search"
);
RadMenuItem search =
new
RadMenuItem(
"Search on Current Values"
);
RadMenuItem endsearch =
new
RadMenuItem(
"End Search"
);
RadMenuItem pages =
new
RadMenuItem(
"Select Page"
);
RadMenuItem injury =
new
RadMenuItem(
"Injury"
);
RadMenuItem report =
new
RadMenuItem(
"Report"
);
RadMenuItem chart =
new
RadMenuItem(
"Chart"
);
RadMenuItem updateref =
new
RadMenuItem(
"Update Lists"
);
menu.Items.Add(save);
menu.Items.Add(cancel);
cancel.Visible =
false
;
menu.Items.Add(create);
menu.Items.Add(delete);
menu.Items.Add(print);
print.Items.Add(printw);
print.Items.Add(printwo);
menu.Items.Add(searchhead);
searchhead.Items.Add(clear);
searchhead.Items.Add(search);
searchhead.Items.Add(endsearch);
menu.Items.Add(pages);
pages.Items.Add(report);
pages.Items.Add(chart);
pages.Items.Add(updateref);
}
Kind regards,
Kate
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 21 Sep 2011, 02:30 PM
I see, so you just moved the menu item declaration inside the PopulateMenu() function. Did you find a way to reliably recreate that, or was it a seemingly random occurrence?
I also added a menu.Items.Clear() at the top of that function, and made the menu parameter by reference. Hopefully this will take care of it.
Thanks Kate.
I also added a menu.Items.Clear() at the top of that function, and made the menu parameter by reference. Hopefully this will take care of it.
Thanks Kate.
0
Hello Marbry,
Yes, we were able to recreate the problem almost every time we made a postback on the page. It seems that the way your class was defined and the use of 'static' were the cause of the problem. I am not sure exactly why it caused a problem, but there is probably some developer's explanation.
Greetings,
Peter
the Telerik team
Yes, we were able to recreate the problem almost every time we made a postback on the page. It seems that the way your class was defined and the use of 'static' were the cause of the problem. I am not sure exactly why it caused a problem, but there is probably some developer's explanation.
Greetings,
Peter
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