Hi Ethan,
This is my Method in which I’ve written an event and again mentioned TextStyle n Areastyle.But nothing get changed
protected void drpVillage_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
ShapeFileFeatureLayer shapeFileLayer = (ShapeFileFeatureLayer)((LayerOverlay)Map1.CustomOverlays[“StaticOverLay”]).Layers[“ShapeLayer”];
shapeFileLayer.DrawingFeatures += new EventHandler(shapeFileLayer_DrawingFeatures);
shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.StandardColors.Gray, 1);
shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(“Gut_Number”, “Arial”, 7, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0);
InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)((LayerOverlay)Map1.CustomOverlays["DynamicOverlay"]).Layers["HighlightLayer"];
highlightLayer.Open();
highlightLayer.Columns.Add(new FeatureSourceColumn("GovtLand_G"));
shapeFileLayer.Open();
SQLstr = "Select Gut_Number from ALL where Village_Na='"+drpVillage.SelectedItem.Text+"'";
dtSQL = shapeFileLayer.QueryTools.ExecuteQuery(SQLstr);
shapeFileLayer.FeatureSource.Open();
Collection<Feature> features1 = shapeFileLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);
highlightLayer.InternalFeatures.Clear();
for (int i = 0; i < features1.Count; i++)
{
if (features1[i].ColumnValues["Village_Na"] == drpVillage.SelectedItem.Text && (features1[i].ColumnValues["GovtLand_G"] == "Forest" || features1[i].ColumnValues["GovtLand_G"] == "Government"))
{
highlightLayer.InternalFeatures.Add(features1[i].Id, features1[i]);
}
}
shapeFileLayer.Close();
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "GovtLand_G";
valueStyle.ValueItems.Add(new ValueItem("Forest", new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(130, 38, 153, 0)))));
valueStyle.ValueItems.Add(new ValueItem("Government", new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(110, 245, 245, 122)))));
highlightLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
if (highlightLayer.InternalFeatures.Count > 0)
{
highlightLayer.Open();
Map1.CurrentExtent = highlightLayer.GetBoundingBox();
highlightLayer.Close();
}
else
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", " alert('No Data Found...');", true);
((LayerOverlay)Map1.CustomOverlays["StaticOverLay"]).Redraw();
}
catch (Exception ex)
{
ex = Errorlog.LoggingError(ex, "LandAssetMapping", "drpVillage_SelectedIndexChanged()");
Response.Redirect("~/Pages/Error.aspx?ExceptionId=" + ex.Data["ExceptionId"].ToString());
}
}
/****** This is an event ******************/
void shapeFileLayer_DrawingFeatures(object sender, DrawingFeaturesEventArgs e)
{
Collection featuresToDrawn = new Collection();
ShapeFileFeatureLayer shapeFileLayer = (ShapeFileFeatureLayer)((LayerOverlay)Map1.CustomOverlays[“StaticOverLay”]).Layers[“ShapeLayer”];
shapeFileLayer.Open();
Collection<Feature> AllFeatures = shapeFileLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);
InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)((LayerOverlay)Map1.CustomOverlays["DynamicOverlay"]).Layers["HighlightLayer"];
highlightLayer.InternalFeatures.Clear();
for (int j = 0; j < AllFeatures.Count; j++)
{
if (AllFeatures[j].ColumnValues["Village_Na"].ToString() == drpVillage.SelectedItem.Text)
{
for (int i = 0; i < dtSQL.Rows.Count; i++)
{
shapeFileLayer.FeatureSource.Open();
//int vGut = GetNumberOnly(dtSQL.Rows[i]["Gut_Number"].ToString());
//Feature vfeature = shapeFileLayer.QueryTools.GetFeatureById(vGut.ToString(), ReturningColumnsType.AllColumns);
Collection<Feature> vfeature = shapeFileLayer.QueryTools.GetFeaturesByColumnValue("Gut_Number", dtSQL.Rows[i]["Gut_Number"].ToString());
if (vfeature != null)
{
featuresToDrawn.Add(vfeature[0]);
}
}
}
}
//}
e.FeaturesToDraw.Clear();
foreach (Feature feature in featuresToDrawn)
{
e.FeaturesToDraw.Add(feature);
}
}