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

RadMenu with WCF and RadGrid

2 Answers 53 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Dinesh
Top achievements
Rank 1
Dinesh asked on 16 Aug 2012, 06:57 AM
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 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 21 Aug 2012, 08:13 AM
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.
0
Dinesh
Top achievements
Rank 1
answered on 22 Aug 2012, 04:46 AM
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");
            } 
Tags
Menu
Asked by
Dinesh
Top achievements
Rank 1
Answers by
Marin
Telerik team
Dinesh
Top achievements
Rank 1
Share this question
or