views:

40

answers:

1

hi, 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, GetProjectCompletedEventArgs 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.

A: 

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.

Koynov