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

[Solved] LoadOnDemand RadContextMenu in RadGrid bugs

1 Answer 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathias
Top achievements
Rank 1
Mathias asked on 06 Feb 2008, 07:05 AM
Hi,

I have a master detail grid where I show a context menu that is populated through a web service. The menu should be different depending on the access rights of the user and if the row is a master of detail row.

In the grid in the ClientSettings-section I have
<ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents>
which points to
            function RowContextMenu(sender, eventArgs)
            {
                document.getElementById("radGridClickedRowIndex").value = eventArgs.get_itemIndexHierarchical();
            }

so I can store the hierarchical key of the row in a hidden field.

In the RadContextMenu I have OnClientItemPopulating="onClientItemPopulatingHandler"
which is
function onClientItemPopulatingHandler(sender, eventArgs)
            {
                var item = eventArgs.get_item();
                var context = eventArgs.get_context();
                context["Row"] = document.getElementById("radGridClickedRowIndex").value;
            }
so I can send the value of the hidden field to the web service that populated the menu.

In the menu I have only the item
<telerik:RadMenuItem Text="Operations" Value="Action" ExpandMode="WebService" PostBack="true"></telerik:RadMenuItem>

Problem 1:
The menu population works fine when retrieving the values for the first time for each row type, i.e. when showing the menu for a master row the menu is retrieved and likewise for a detail row. However, the second time i right-click on a master or detail row the menu isn't retrieved from the web service again even though I have PersistLoadOnDemandItems=false, i.e. the same menu is shown for all master rows and the same menu is shown for all detail rows. I need the menu to be retrieved for each row because the user doesn't have the same rights to all rows. How can I do this?

------------------

Problem 2:
In the RadContextMenu I have OnItemClick="ContextMenu_ItemClick" that should fire the ContextMenu_ItemClick method when a menu item i clicked. In the menu I have one static item Operations (shown above) and when clicking that a postback is done. The problem is that no postback happens when clicking the dynamically loaded items even though I set .PostBack=true for each RadMenuItemData that is returned by the web service.

Is this a bug or am I doing something wrong? If it's a bug can it be worked around by adding some javascript?

Regards,
Mathias

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 06 Feb 2008, 12:11 PM
Hi Mathias,

The first problem you describe is actually by design - a menu item is populated only once. Setting PersistLoadOnDemandItems to false will not have any effect on that behavior. On the contrary - it will prevent postbacks from working correctly because no items will be persisted on the server side which is vital for the ItemClick event.

Could you please open a formal support ticket and send us your page? This will help us understand your scenario and provide a workaround. Thanks.


Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mathias
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or