RadMenu with WCF and RadGrid

3 posts, 0 answers
  1. Dinesh
    Dinesh avatar
    13 posts
    Member since:
    May 2008

    Posted 16 Aug 2012 Link to this post

    Hi,

    I need a help regarding the Read menu with WCF and radgrid. 

    I have a red grid with template column. In Template column there is a RedMenu. That rad menu items will be desided (when expand get from WCF service) . I followed the link below. It worked well.  

    http://www.telerik.com/help/aspnet-ajax/menu-items-wcf-service.html.

    But in my case I need to pass data from the row in DataGrid to WCF service. For example will assume grid containes Order details and column with "Order Number". I need to pass the "Order Number" to the WCF method as done in above sample.

    sample has done this using js method as follows.

    function OnClientItemPopulatingHandler(sender, e) 
        {        
            var context = e.get_context();
            //using jQuery to get the checked item and pass it to the server        
            context["ProductSuite"] = $telerik.$("input[name='rblSuites']:checked").val();
        }

    I need to do this as follows

    function OnClientItemPopulatingHandler(sender, e) 
        {        
            var context = e.get_context();
            //using jQuery to get the checked item and pass it to the server        
            context["OrderNumber"] = GET THE ORDER NUMBER FROM ROW BELONGS TO THE RADMENU.
        }

    can anybody help me to resolve this ?

    Thank you
  2. Marin
    Admin
    Marin avatar
    1043 posts

    Posted 21 Aug 2012 Link to this post

    Hi,

     You can use the grid's client-side API to access any data from the row on the client:
    http://www.telerik.com/help/aspnet-ajax/grid-griddataitem-get-cell.html 

    All the best,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dinesh
    Dinesh avatar
    13 posts
    Member since:
    May 2008

    Posted 21 Aug 2012 Link to this post

    Hi,

    Thank you for the replies, I got solved it using following way.
    I added ClientDataKeyNames to MasterTableView 

     <MasterTableView AllowCustomSorting="True" AllowNaturalSort="False" ClientDataKeyNames="GroupId,Status" >

    from javascript I access as follows for selected row.

                var grid = $find("<%=myGrid.ClientID %>");
                var masterTableView = grid.get_masterTableView();

                var selectedRows = masterTableView.get_selectedItems();

                for (var i = 0; i < selectedRows.length; i++) {
                    var row = selectedRows[i];

                    context["TaskGroup"] = row.getDataKeyValue("GroupId");
                    context["Status"] = row.getDataKeyValue("Status");
                } 
Back to Top