Select to view content in your preferred language

How to get edited data from FeatureDataForm

425
2
07-13-2011 01:19 PM
DonFreeman
Emerging Contributor
My map page contains a popup which contains a FeatureDataForm used to edit the attributes of the selected feature. The FeatureDataForm is defined like this:
      <esri2:FeatureDataForm x:Name="MyFeatureDataForm"   
       FeatureLayer="{Binding Path=Layers[AllAvailableFeatureLayer], ElementName=MyMap}" 
       IsEnabled="True"
                            IsReadOnly="False" 
       LabelPosition="Left"
       CommitButtonContent="Save" />

Following the SAVE I want to summarize the new data and place it into an email that will be sent to the Administrator. My question is - Can the data be read directly out of the FeatureDataForm, or must it be read out of the graphic? And in either case, how is it done?

Seems like something like this should work but last line fails. Why?
<CODE>
Graphic SelectedGraphic = MyFeatureDataForm.GraphicSource;
           
            IDictionary<string, object> attributes = SelectedGraphic.Attributes;
            var keyID = attributes["ID_Signup"];

            var myVar  = attributes["Location"];

            MessageBox.Show(myVar);
</CODE>

Thanks
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
MessageBox.Show(myVar) fails because myVar is an object.
You can try:
MessageBox.Show(string.Format("{0}", myVar));


To answer your other question, yes you would have to go through the graphic.Attributes.
foreach (var item in g.Attributes)
 MessageBox.Show("{0}: {1}", item.Key, item.Value);
0 Kudos
DonFreeman
Emerging Contributor
Thanks Jenn.
I also found you can code the var like this:
 var msgToAM = attributes["EmailAM"] as string ;

Which also works.
0 Kudos