I gave it another go, and I was able to come up with a good solution!Basically, I followed the code above to use js to send/receive the WMS GetFeatureInfo query. I used "INFO_FORMAT=text/xml", and wrote a function in csharp to parse the results and add it to the datagrid.private void GetDataFromXml(IdentifyResult result, string xmlmarkup)
{
XmlReader reader = XmlReader.Create(new StringReader(xmlmarkup));
int i = -1;
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an element.
IDictionary<string,object> featureatts = new Dictionary<string,object>();
while (reader.MoveToNextAttribute())
{// Read the attributes.
featureatts.Add(reader.Name,reader.Value);
}
i+=1;
adddataitems(i,result,featureatts);
break;
case XmlNodeType.Text:
break;
case XmlNodeType.EndElement:
break;
}
}
}
public void adddataitems(int i, IdentifyResult result, IDictionary<string,object> featureatts)
{
if (featureatts.Count > 0)
{
string title = result.Value.ToString() + "_" + i + " (" + result.LayerName + ")";
IdentifyComboBox.Items.Add(title);
_dataItems.Add(new DataItem()
{
Title = title,
Data=featureatts
});
}
}
public void ShowFeatures(List<IdentifyResult> results)
{
_dataItems = new List<DataItem>();
if (results != null && results.Count > 0)
{
IdentifyComboBox.Items.Clear();
string htmlreq = "";
string xmlreq = "";
string xmlmarkup = "";
foreach (IdentifyResult result in results)
{
Graphic feature = result.Feature;
if (result.Value.ToString().IndexOf("WMS") >= 0)
{
htmlreq = feature.Attributes["URL"].ToString();
xmlreq = htmlreq.Replace("INFO_FORMAT=text/html","INFO_FORMAT=text/xml");
xmlmarkup = (string)HtmlPage.Window.Invoke("getfeatureinfo",xmlreq);
GetDataFromXml(result,xmlmarkup);
}
else
{
string title = result.Value.ToString() + " (" + result.LayerName + ")";
IdentifyComboBox.Items.Add(title);
_dataItems.Add(new DataItem()
{
Title = title,
Data=feature.Attributes
});
}
}
IdentifyComboBox.SelectedIndex = 0;
}
}
I'm sure this could be beefed up, but it works for now. My goal was to handle Identify requests to both ArcGIS Server and WMS layers, with the output presented in the same way for each type of layer. This code does that, at least on my system. Caution: One headache - Firefox users...in order to use the js and overcome the crossdomain problem, you must enter about:config in the URL bar and change signed.applets.codebase_principal_support to true. I'm not entirely sure how this affects Firefox, so buyer beware. I do believe this alters the proxy settings in FF. I had to repeatedly change them in Tools->Options->Advanced, Network Tab in Firefox. The default is to use system proxy settings, but I believe this code (something definitely was...not sure of the culprit) was changing to a manual proxy configuration, which kills many other webpages.Hope this is of useMike