Hello!
Background first: I've got a form that is receiving data via a WCF webservice and is called GetSitesByCompanyId. The data is run on load (with a hardcoded company id for testing) and used to populate a dropdown box of Site Names. What I'm trying to do is to use code to populate details for the site when a selection is made from the dropdown. I can match the site name with a site id (although this involved the possibly dodgy method of creating a dictionary of site name to site id and populating said dictionary on form load), but I cannot seem to formulate an XPath query that will find the appropriate details in the result set for the given site id.
Here's the code that I have. Any help would be greatly appreciated! If nothing else, a method for shortening the absolute paths I'm using would be good. :)
/////////////////////////////
// Set the site detail fields
DataSource dsSites = this.DataSources["GetSitesByCompanyId"];XPathNavigator xnSites = dsSites.CreateNavigator();
XPathNavigator addressLine1 = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:SiteDetails/my:group4/my:AddressLine1", ns);
XPathNavigator addressLineResult = xnSites.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetSitesByCompanyIdResponse/tns:GetSitesByCompanyIdResult/q1:Site/q1:AddressLine1[/dfs:myFields/dfs:dataFields/tns:GetSitesByCompanyIdResponse/tns:GetSitesByCompanyIdResult/q1:Site/q1:SiteId=\"" + siteId.ToString() + "\"])", ns);