AnsweredAssumed Answered

Editing the Attributes of a feature Programmatically

Question asked by jessicalott on Sep 19, 2014
Latest reply on Sep 22, 2014 by jareds22

I have a feature layer with features that I would like to update programmatically. Below is my code:

 

 

        private void EditQueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)

        {

            try

            {

                if (txtServiceType.Text.Contains("Water") || txtServiceType.Text.Contains("WATER"))

                {

                    FeatureLayer fl = MyMap.Layers["Meters"] as FeatureLayer;

                    List<int> deletedServiceOrders = new List<int>();

 

                    FeatureSet fs = args.FeatureSet;

 

                    fs.Features[0].Attributes["PWSID"] = txtMeterNumber.Text;

                    fs.Features[0].Attributes["CIS_METR"] = txtAccountNumber.Text;

                    fs.Features[0].Attributes["CUSTYPE"] = txtCustType.Text;

                    fs.Features[0].Attributes["STR"] = txtStreet.Text;

                    fs.Features[0].Attributes["CITY"] = txtCity.Text;

                    fs.Features[0].Attributes["COMMENTS"] = txtName.Text;

 

                   

                    fl.SaveEdits();

                    fl.Update();

                    DeleteServiceOrder.Visibility = Visibility.Collapsed;

                    fl.EndSaveEdits += featurelayerSO_EndSaveEdits;

                    fl.SaveEditsFailed += featurelayerSO_SaveEditsFailed;

                }

            }

            catch (Exception e)

            {

                MessageBox.Show(e.Message);

            }

        }

 

 

Everything is being set correctly and there are no errors, but the values are not actually being saved into ESRI. I am thinking it has something to do with nothing has ever actually be edited? I know I am missing something. Any help would be appreciated!

Outcomes