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

Example FileBrowser question

2 Answers 75 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Zhengmao
Top achievements
Rank 1
Zhengmao asked on 24 Apr 2008, 01:17 PM

for the example FileBrowser I have few question about RadContextMenu associate with GridView,

I'd like to use the client event handle 

OnClientItemClicked

="GridContextMenu"

<script type="text/javascript">

function GridContextMenu(sender, args)

{

//sender.hide();

alert(

"create") ;

alert(args.get_Item()) ;

if (args.get_menuItem().get_text() == "Create Ticket")

{

alert(

"Create Ticket") ;

}

}

<script type="text/javascript">

 

function GridContextMenu(sender, args)

{

//sender.hide();

 

alert(

"create") ;

alert(args.get_Item()) ;

if (args.get_menuItem().get_text() == "Create Ticket")

{

alert(

"Create Ticket") ;

}

}

</

script>

how can I retrive which menu item is selected and how to get grid Row and data fro gridview from client, I used <ItemTemplate> in gridview, how can I get data from it?


Thanks,

Zhengmao,

2 Answers, 1 is accepted

Sort by
0
Zhengmao
Top achievements
Rank 1
answered on 24 Apr 2008, 07:01 PM
anyone can answer my question?
0
Peter
Telerik team
answered on 25 Apr 2008, 02:35 PM
Hi Zhengmao,

Use OnRowContextMenu event of RadGrid to show the menu. Here is an example function which you can call on OnRowContextMenu:
 function rowContextMenu(index)  
            {  
           
                var menu = <%= ContextMenu.ClientID %>;  
                alert(menu);  
                menu.Show(e);  
                  
                e.cancelBubble = true;  
                e.returnValue = false;  
 
                if (e.stopPropagation)  
                {  
                   e.stopPropagation();  
                   e.preventDefault();  
                }  
                 
            }  
 
 

You may also find helpful the following topics:

Extracting key values client-side

Using RadWindow for editing/inserting RadGrid records 

You can differentiate among the menu items in the OnClientItemClicking event handler by value, text, url or any other property or custom attribute. Just like what you have already used:

if (args.get_menuItem().get_text() == "Create Ticket")

If you have any other questions, please feel free to contact us.



Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Menu
Asked by
Zhengmao
Top achievements
Rank 1
Answers by
Zhengmao
Top achievements
Rank 1
Peter
Telerik team
Share this question
or