开发者

passing parameter as to webservcie function in wcf

this my datagrid event here i am calling the webservice.

    private void dgProject_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e)
    {
WSDataServiceClient wsService = new WSDataServiceClient();

 wsService.GetProjectCompleted += new EventHandler<GetProjectCompletedEventArgs>(wsService_GetProjectCompleted);
                        wsService.GetProjectAsync(strUniqueName);

// here can i send datagrid as an parameter to the function? Datagrid gd= new Datagrid(); }

 void wsService_GetProjectCompleted(object sender, GetProjectComplet开发者_运维百科edEventArgs e)
        {
//

 }

is there any way that i can send datagrid as a paramter to this function is it possiable to do? beacuse i will be using the same websevice function her but need to bind result with different datagrid based on the condition if i can send a datagrid as paramter to this function i can reduce the code so

any help on this issue would be great thank you.


So you want to pass a reference a datagrid and when web service call is completed you want to populate that grid with the data. If you insist to to use the same function you probably can make the call of the async function that way:

wsService.GetProjectAsync(strUniqueName,yourDataGrid);

and when the call is completed you can access that grid:

void wsService_GetProjectCompleted(object sender, GetProjectCompletedEventArgs e) { DataGrid grid = e.UserState as DataGrid; //your code here }

I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜