DataTable tableLayers = new DataTable("Layers");
protected void Page_Load(object sender, EventArgs e)
{
intializeDataTable();
ListBox1.DataSource = tableLayers;
ListBox1.DataTextField = "layerID";
ListBox1.DataBind();
updateTestTable();
}
private void updateTestTable()
{
tableLayers.Clear();
//// get the count of the items on the map
int layercount = ScubaMap.GetShapeLayerCount();
//// iterate through the map layers, adding the layers to datatable
for (int i = 0; i < layercount; i++)
{
DataRow row = tableLayers.NewRow();
row["layerID"] = ScubaMap.GetShapeLayerByIndex(i).ID.ToString();
row["layerDesc"] = ScubaMap.GetShapeLayerByIndex(i).Description.ToString();
tableLayers.Rows.Add(row);
}
ListBox1.DataBind();
}
private DataTable intializeDataTable()
{
tableLayers.Columns.Add("layerID", typeof(string));
tableLayers.Columns.Add("layerDesc", typeof(string));
return tableLayers;
}