private static string GetValue(DataGridColumn col, Graphic graphic) { if (col is DataGridBoundColumn) { DataGridBoundColumn column = col as DataGridBoundColumn; if ((column.Binding != null) && (column.Binding.Path != null)) { string path = column.Binding.Path.Path; if (!string.IsNullOrEmpty(path)) { var att = Regex.Replace(path, ".*\\[(.*)\\]", "$1"); return graphic.Attributes[path] == null ? string.Empty : graphic.Attributes[path].ToString(); } } } return string.Empty; }
private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; // If initial query to populate states combo box if ((args.UserState as string) == "initial") { // Just show on initial load QueryComboBox.Items.Add("Select..."); foreach (Graphic graphic in args.FeatureSet.Features) { QueryComboBox.Items.Add(graphic.Attributes["NAMN"].ToString()); } QueryComboBox.SelectedIndex = 0; return; }
But then it underlines "GetValue" and says: "'ESRIMinimalMapApplication3.DataGridExtensions.GetValue(System.Windows.FrameworkElement)': not all code paths return a value"Please help
private static string GetValue(FrameworkElement frameworkElement) { if (frameworkElement != null) { return frameworkElement is TextBlock ? (frameworkElement as TextBlock).Text : frameworkElement.ToString(); } else return null; }
private static string GetValue(FrameworkElement frameworkElement) { return frameworkElement is TextBlock ? (frameworkElement as TextBlock).Text : frameworkElement.ToString(); }
private static string GetValue(FrameworkElement frameworkElement) { if (frameworkElement != null) { return frameworkElement is TextBlock ? (frameworkElement as TextBlock).Text : frameworkElement.ToString(); } }
I tweaked the Darina's code to get it working with the sample you pointed out.Attached are the sources and an example of output csv file.
Darina gave a solution in these threads:- http://forums.arcgis.com/threads/245...d-Excel-Export- http://forums.arcgis.com/threads/13460-Export-to-Excel...
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.