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

How to disable RadMenuItem in Context Menu when click over Radgrid

2 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raja Mohammed
Top achievements
Rank 1
Raja Mohammed asked on 14 May 2010, 09:15 AM
Hi,

How to disable RadMenuItem in Context Menu when click over Radgrid . which is suitable event to place a code..

     if (Convert.ToInt32(RadGrid1.SelectedItems.Count) > 1)
      {
          ...Code here Disable the Menu item..

     }

in Which event this code placed..either in  RadGrid based Event   ( or )  Radmenu based Events..

Advance thanks for your help.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2010, 11:57 AM

Hello Raja,

Based on your requirement, I guess its is easy to handle the RadMenuItems in RadMenu's client event. Here is the approach that you can try.

    Attach 'OnClientShowing' event to RadContextMenu and check for the selecteditems' count in the handler. Now based on the count, access the menu item and set it disabled/enabled. You can use the findItemByValue/findItemByText/findItemByUrl methods to get reference to menu items.

Also the following docuemnatation shows more on the client methods and poropeties.

RadMenu and RadContextMenu objects

A sample code is shown below:

 
    function OnClientShowing(sender, args) {  
        var master = $find("<%=RadGrid1.ClientID %>").get_masterTableView();  
        if (master.get_selectedItems().length > 1) {  
            alert('Disable some items');  
        }  
    } 

Cheers,

Shinu.

0
Raja Mohammed
Top achievements
Rank 1
answered on 16 May 2010, 12:53 PM
Thanks so much for your reply.Now its working fine..
Tags
Grid
Asked by
Raja Mohammed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Raja Mohammed
Top achievements
Rank 1
Share this question
or