MapViewer with feature attribute display

MapViewer sample to illustrate feature selection and displaying attribute data in a GridTable.

The DotNet GridTable component provides an easy way to display the tabular data of features in a mobile application. By using these components with the datatables from the Mobile layers, you can quickly access and navigate the table's records or features.

ADO components can also be used to easily display tabular data in a standard format. The sample referenced below illustrates how to populate a datatable and display that information in a datagrid component.

This code block shows how to use the FeatureDataReader to populate the Datatable, then assign the DataTable to the Grid for display.

using (FeatureDataReader readData = mobileCache1.FeatureSources[layerName].GetDataReader(identifyQuery))

          while (readData.Read())
          {
            DataRow dataRow = dataTable1.NewRow();
            // add the feature values  
            for (int j = 0; j < numFields; j++)
              {
              dataRow[j] = readData.GetValue(j);
              }         
            //add row to the datatable you create
            dataTable1.Rows.Add(dataRow);
          }
//finally bind the datagrid on the UI to the Datatable just just built
dataGridFeatures.DataSource = dataTable1;

Where to get the sample

The sample is available for download from the ArcGIS.com code gallery.

1/7/2015