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

RadContextMenu showing incorrect items when used in RadMultiPage

1 Answer 48 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Aaron Mell
Top achievements
Rank 1
Aaron Mell asked on 15 Feb 2010, 06:31 PM

I have a RadContextMenu that is bound to a Radgrid. The context menu just allows the user to set the number of rows per page to show. When I use the Context menu on a RadMultipage that has several radgrids, the items being bound to the ContextMenu are incorrect.

For example the first RadContextMenu will have the following items added to it. (5,10,25,100,250,500)

Several other RadContextMenus on the Multipage will have this set of items added to it. (5,10,25,100)

When the page loads, every single ContextMenu on the different pages inside the Multipage has the first set of items added to it. The m_MaximumPaerRowsToDisplay property is being set correctly before OnInit is fired(I can step through and see that the other context menus are having the correct item set added).

The Items are being added to the ContextMenu during the OnInit event.


RadContextMenu1 = new RadContextMenu(); 
        RadMenuItem rmi = new RadMenuItem("Rows To Display".Localize()); 
        //there should always be at least a 5 rows added. 
        rmi.Items.Add(new RadMenuItem("5")); 
        if (m_MaximumPagerRowsToDisplay >= 10) 
            rmi.Items.Add(new RadMenuItem("10")); 
        if (m_MaximumPagerRowsToDisplay >= 25) 
            rmi.Items.Add(new RadMenuItem("25")); 
        if (m_MaximumPagerRowsToDisplay >= 50) 
            rmi.Items.Add(new RadMenuItem("50")); 
        if (m_MaximumPagerRowsToDisplay >= 100) 
            rmi.Items.Add(new RadMenuItem("100")); 
        if (m_MaximumPagerRowsToDisplay >= 250) 
            rmi.Items.Add(new RadMenuItem("250")); 
        if (m_MaximumPagerRowsToDisplay >= 500) 
            rmi.Items.Add(new RadMenuItem("500")); 
        if (m_MaximumPagerRowsToDisplay >= 1000) 
            rmi.Items.Add(new RadMenuItem("1000")); 

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Aaron Mell
Top achievements
Rank 1
answered on 15 Feb 2010, 07:33 PM
I solved the issue. It wasn't related to the ContextMenu itself, it was related to the ContextMenu Event. The event being added to the page in javascript was only being added for one control, instead of each control having their own seperate event. I added the ClientID to the function and the event name and that fixed the issue.
Tags
Menu
Asked by
Aaron Mell
Top achievements
Rank 1
Answers by
Aaron Mell
Top achievements
Rank 1
Share this question
or