简体   繁体   English

RadContextMenu在RadMultiPage中使用时显示不正确的项目

[英]RadContextMenu showing incorrect items when used in RadMultiPage

I have a RadContextMenu that is bound to a Radgrid. 我有一个绑定到Radgrid的RadContextMenu。 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. 当我在具有多个radgrids的RadMultipage上使用上下文菜单时,绑定到ContextMenu的项目不正确。

For example the first RadContextMenu will have the following items added to it. 例如,第一个RadContextMenu将添加以下项目。 (5,10,25,100,250,500) (5,10,25,100,250,500)

Several other RadContextMenus on the Multipage will have this set of items added to it. 多页上的其他几个RadContextMenus将添加此项目集。 (5,10,25,100) (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. 页面加载时,多页面内不同页面上的每个ContextMenu都添加了第一组项目。 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). 在触发OnInit之前,已正确设置了m_MaximumPaerRowsToDisplay属性(我可以逐步执行,看看其他上下文菜单中是否添加了正确的项目集)。

The Items are being added to the ContextMenu during the OnInit event. 这些项目将在OnInit事件期间添加到ContextMenu中。

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? 有任何想法吗?

I solved the issue. 我解决了这个问题。 It wasn't related to the ContextMenu itself, it was related to the ContextNenu Event. 它与ContextMenu本身无关,与ContextNenu事件有关。 The even being added to the page in javascript was only being added for one control, instead of each control having their own event. 偶数被添加到javascript页面中只是为一个控件添加,而不是每个控件都有自己的事件。 I added the ClientID of the control to the Event name and when registering the script and that fixed the issue. 我将控件的ClientID添加到了事件名称中,并在注册脚本时将其修复,从而解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM