Map Web Control框选查询绑定到GridView1,为什么没有显示?
框选查询绑定到GridView1,为什么没有显示?
protected void Map1_DragRectangle(object sender, ToolEventArgs args)
{
ESRI.ArcGIS.ADF.Web.Geometry.Envelope env = null;
if (args.ToolName == "Select")
{
RectangleEventArgs RectangleEventArgs1 = args as RectangleEventArgs;
ESRI.ArcGIS.ADF.Web.Geometry.Envelope MapEnv1 = ESRI.ArcGIS.ADF.Web.Geometry.Envelope.ToMapEnvelope(RectangleEventArgs1.ScreenExtent, Map1.Extent, (int)Map1.Width.Value, (int)Map1.Height.Value);
env = MapEnv1 as ESRI.ArcGIS.ADF.Web.Geometry.Envelope;
select(env);
Map1.Refresh();
}
public void select(ESRI.ArcGIS.ADF.Web.Geometry.Envelope env)
{
IEnumerable func_enum = Map1.GetFunctionalities();
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
{
ESRI.ArcGIS.ADF.Web.DataSources.IGISResource gisresource = gisfunctionality.Resource;
bool supported = gisresource.SupportsFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality));
if (supported)
{
ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality qfunc;
qfunc = (ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)gisresource.CreateFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), null);
string[] lids;
string[] lnames;
qfunc.GetQueryableLayers(null, out lids, out lnames);
ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter = new ESRI.ArcGIS.ADF.Web.SpatialFilter();
spatialfilter.ReturnADFGeometries = true;
spatialfilter.MaxRecords = 1000;
spatialfilter.Geometry = env;
System.Data.DataTable datatable = qfunc.Query(gisfunctionality.Name, "14", spatialfilter);
this .GridView1 .DataSource =datatable ;
this.GridView1.DataBind();
}
}
高手帮我调试一下,谢谢
protected void Map1_DragRectangle(object sender, ToolEventArgs args)
{
ESRI.ArcGIS.ADF.Web.Geometry.Envelope env = null;
if (args.ToolName == "Select")
{
RectangleEventArgs RectangleEventArgs1 = args as RectangleEventArgs;
ESRI.ArcGIS.ADF.Web.Geometry.Envelope MapEnv1 = ESRI.ArcGIS.ADF.Web.Geometry.Envelope.ToMapEnvelope(RectangleEventArgs1.ScreenExtent, Map1.Extent, (int)Map1.Width.Value, (int)Map1.Height.Value);
env = MapEnv1 as ESRI.ArcGIS.ADF.Web.Geometry.Envelope;
select(env);
Map1.Refresh();
}
public void select(ESRI.ArcGIS.ADF.Web.Geometry.Envelope env)
{
IEnumerable func_enum = Map1.GetFunctionalities();
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
{
ESRI.ArcGIS.ADF.Web.DataSources.IGISResource gisresource = gisfunctionality.Resource;
bool supported = gisresource.SupportsFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality));
if (supported)
{
ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality qfunc;
qfunc = (ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)gisresource.CreateFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), null);
string[] lids;
string[] lnames;
qfunc.GetQueryableLayers(null, out lids, out lnames);
ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter = new ESRI.ArcGIS.ADF.Web.SpatialFilter();
spatialfilter.ReturnADFGeometries = true;
spatialfilter.MaxRecords = 1000;
spatialfilter.Geometry = env;
System.Data.DataTable datatable = qfunc.Query(gisfunctionality.Name, "14", spatialfilter);
this .GridView1 .DataSource =datatable ;
this.GridView1.DataBind();
}
}
高手帮我调试一下,谢谢
加油,哥们,现在开始!