views:

289

answers:

1

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?

A: 

I solved the issue. It wasn't related to the ContextMenu itself, it was related to the ContextNenu Event. The even being added to the page in javascript was only being added for one control, instead of each control having their own event. I added the ClientID of the control to the Event name and when registering the script and that fixed the issue.

Aaron M