Pass Data from Parent window to query in Child Window
Posted on 2010-08-16
I have a silverlight page which has a list of users (for example) and I am trying to get it so that when i click on it, a child window appears and within that window there is another datagrid that is to be populated with data from tables based on the user i selected from the list box.
I am having difficultly passing userID to the wcf query behind the datagrid in the child window. The datagrid returns empty.
could you please correct me in where i am going wrong please..the code i have is below
**this code i have in the MainPage.xaml for the listbox_selected changed event.**
ServiceReference1.site test = (site)ListBox1.SelectedItem;
ChildShowDeviceResults cmod = new ChildShowDeviceResults();
cmod.DataContext = test;
**in the ChildWindow I have placed a textbox just to see if i can bind a value to it from the datacontext from the MainPage. When i load the childwindow, i can see taht the textbox shows the actual id of the user i selected, but then when i try to run the Page_Loaded event, the query doesnt seem to take the value into its parameters**
private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
_ServiceClient client = new _ServiceClient();
client.getResultsByIDCompleted += new EventHandler<getResultsByIDCompletedEventArgs>(client_getResultsByIDCompleted);
this does not seem to work.
any help would be much appreciated.