parameter index

Oct 23, 2007 at 9:42 AM
when iam clicking on the query map to findout the area details in grid in gradient page.
Iam getting an error as Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
near this line VectorLayer layer = myMap.Layers0 as SharpMap.Layers.VectorLayer;
in the below code
protected void imgMap_Click(object sender, ImageClickEventArgs e)
{
SharpMap.Map myMap = new SharpMap.Map(new Size(Convert.ToInt32(imgMap.Width.Value), Convert.ToInt32(imgMap.Height.Value)));
myMap.Center = Center;
myMap.Zoom = Zoom;
Center = myMap.ImageToWorld(new System.Drawing.Point(e.X, e.Y));

if (rblMapTools.SelectedValue == "0") //Zoom in
Zoom = Zoom * 0.5;
else if (rblMapTools.SelectedValue == "1") //Zoom outm
Zoom = Zoom * 2;
else if (rblMapTools.SelectedValue == "3")
{

SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();

VectorLayer layer = myMap.Layers0 as SharpMap.Layers.VectorLayer;

layer.DataSource.Open();

layer.DataSource.ExecuteIntersectionQuery(Center.GetBoundingBox(), ds);

layer.DataSource.Close();

GridView1.DataSource = ds.Tables0;
GridView1.DataBind();
}

GenerateMap();
}
how to get tid of the error.