Example FileBrowser question

3 posts, 0 answers
  1. Zhengmao
    Zhengmao avatar
    12 posts
    Member since:
    Apr 2008

    Posted 24 Apr 2008 Link to this post

    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. Zhengmao
    Zhengmao avatar
    12 posts
    Member since:
    Apr 2008

    Posted 24 Apr 2008 Link to this post

    anyone can answer my question?
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 25 Apr 2008 Link to this post

    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
Back to Top