using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;public partial class _Default : System.Web.UI.Page
{
namespace SetPosByAttr 错误 2 类、结构或接口成员声明中的标记“namespace”无效 { 错误 3 类、结构或接口成员声明中的标记“{”无效 public partial class _Default : System.Web.UI.Page,ICallbackEventHandler
{
public string m_ADFCallbackFunctionString;
protected void Page_Load(object sender, EventArgs e)
{
m_ADFCallbackFunctionString = Page.ClientScript.GetCallbackEventReference(this, "message",
"processCallbackResult", "context", "postBackError", true);
} public void RaiseCallbackEvent(string eventArgs)
{
System.Collections.IEnumerable.func_enum=null;
//获取当前map1控件中所有的functionality
func_enum=Map1.GetFunctionalities(); System.Data.DataTable datatable;
//对所有的functionality进行遍历
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
{
ESRI.ArcGIS.ADF.Web.DataSources.IGISDataSource gisresource=null;
//得到该functionality的resource
gisresource=gisfunctionality.Resource;
//判断该resource是否支持IQueryFunctionality
bool support=false;
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.CreateFuntionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality),null);
string[] lids;
string[] lnames;
//获得图层的layerId和layerName,GetQueryableLayers的重载方法可以指定图层类型
qfunc.GetQueryableLayers(null,out lids,out lnames); int selindex=-1;
for (int i=0;i<lids.Length;i++)
{
if (lnames[i]=="变压器")
{
//找到变压器图层的序号
selindex=i;
break ;
}
} if (selindex > -1)
{
//设置过滤器的过滤条件
ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter=new ESRI.ArcGIS.ADF.Web.SpatialFilter();
spatialfilter.ReturnADFGeometries=true;
spatialfilter.MaxRecords=100;
spatialfilter.WhereClause="name like '%"+eventArgs+"%'"; //对指定的图层进行查询,查询的结果保存为
datatable=qfunc.Query(null,lids[selindex],spatialfilter);
if (datatable !=null)
{
if (datatable.Rows.Count>0)
{
for (int j=0;j<datatable.Columns.Count;j++)
{
if (datatable.Columns[j].DataType==typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
{
ESRI.ArcGIS.ADF.Web.Geometry.Point pnt=(ESRI.ArcGIS.ADF.Web.Geometry.Point)datatable.Rows[0][j];
Map1.CenterAt(pnt);
m_ADFCallbackFunctionString=Map1.CallbackResults.ToString();
return;
}
} }
else
{
object[] ob=new object[1];
string sa="alert('没有找到该变压器');";
ob[0]=sa;
ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult callbackresult=new ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult(null,null,"Javascript",ob);
Map1.CallbackResults.Add(callbackresult);
m_ADFCallbackFunctionString=Map1.CallbackResults.ToString(); }
}
}
} }
}
}
}
}错误 4 应输入类型、命名空间定义或文件尾警告 1 应为表达式
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;public partial class _Default : System.Web.UI.Page
{
namespace SetPosByAttr 错误 2 类、结构或接口成员声明中的标记“namespace”无效 { 错误 3 类、结构或接口成员声明中的标记“{”无效 public partial class _Default : System.Web.UI.Page,ICallbackEventHandler
{
public string m_ADFCallbackFunctionString;
protected void Page_Load(object sender, EventArgs e)
{
m_ADFCallbackFunctionString = Page.ClientScript.GetCallbackEventReference(this, "message",
"processCallbackResult", "context", "postBackError", true);
} public void RaiseCallbackEvent(string eventArgs)
{
System.Collections.IEnumerable.func_enum=null;
//获取当前map1控件中所有的functionality
func_enum=Map1.GetFunctionalities(); System.Data.DataTable datatable;
//对所有的functionality进行遍历
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
{
ESRI.ArcGIS.ADF.Web.DataSources.IGISDataSource gisresource=null;
//得到该functionality的resource
gisresource=gisfunctionality.Resource;
//判断该resource是否支持IQueryFunctionality
bool support=false;
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.CreateFuntionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality),null);
string[] lids;
string[] lnames;
//获得图层的layerId和layerName,GetQueryableLayers的重载方法可以指定图层类型
qfunc.GetQueryableLayers(null,out lids,out lnames); int selindex=-1;
for (int i=0;i<lids.Length;i++)
{
if (lnames[i]=="变压器")
{
//找到变压器图层的序号
selindex=i;
break ;
}
} if (selindex > -1)
{
//设置过滤器的过滤条件
ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter=new ESRI.ArcGIS.ADF.Web.SpatialFilter();
spatialfilter.ReturnADFGeometries=true;
spatialfilter.MaxRecords=100;
spatialfilter.WhereClause="name like '%"+eventArgs+"%'"; //对指定的图层进行查询,查询的结果保存为
datatable=qfunc.Query(null,lids[selindex],spatialfilter);
if (datatable !=null)
{
if (datatable.Rows.Count>0)
{
for (int j=0;j<datatable.Columns.Count;j++)
{
if (datatable.Columns[j].DataType==typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
{
ESRI.ArcGIS.ADF.Web.Geometry.Point pnt=(ESRI.ArcGIS.ADF.Web.Geometry.Point)datatable.Rows[0][j];
Map1.CenterAt(pnt);
m_ADFCallbackFunctionString=Map1.CallbackResults.ToString();
return;
}
} }
else
{
object[] ob=new object[1];
string sa="alert('没有找到该变压器');";
ob[0]=sa;
ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult callbackresult=new ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult(null,null,"Javascript",ob);
Map1.CallbackResults.Add(callbackresult);
m_ADFCallbackFunctionString=Map1.CallbackResults.ToString(); }
}
}
} }
}
}
}
}错误 4 应输入类型、命名空间定义或文件尾警告 1 应为表达式
如下
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;namespace SetPosByAttr
{
public partial class _Default : System.Web.UI.Page, ICallbackEventHandler
{
public string m_ADFCallbackFunctionString;
protected void Page_Load(object sender, EventArgs e)
{
m_ADFCallbackFunctionString = Page.ClientScript.GetCallbackEventReference(this, "message",
"processCallbackResult", "context", "postBackError", true);
} public void RaiseCallbackEvent(string eventArgs)
{
System.Collections.IEnumerable.func_enum = null;
//获取当前map1控件中所有的functionality
func_enum = Map1.GetFunctionalities(); System.Data.DataTable datatable;
//对所有的functionality进行遍历
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
{
ESRI.ArcGIS.ADF.Web.DataSources.IGISDataSource gisresource = null;
//得到该functionality的resource
gisresource = gisfunctionality.Resource;
//判断该resource是否支持IQueryFunctionality
bool support = false;
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.CreateFuntionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), null);
string[] lids;
string[] lnames;
//获得图层的layerId和layerName,GetQueryableLayers的重载方法可以指定图层类型
qfunc.GetQueryableLayers(null, out lids, out lnames); int selindex = -1;
for (int i = 0; i < lids.Length; i++)
{
if (lnames[i] == "变压器")
{
//找到变压器图层的序号
selindex = i;
break;
}
} if (selindex > -1)
{
//设置过滤器的过滤条件
ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter = new ESRI.ArcGIS.ADF.Web.SpatialFilter();
spatialfilter.ReturnADFGeometries = true;
spatialfilter.MaxRecords = 100;
spatialfilter.WhereClause = "name like '%" + eventArgs + "%'"; //对指定的图层进行查询,查询的结果保存为
datatable = qfunc.Query(null, lids[selindex], spatialfilter);
if (datatable != null)
{
if (datatable.Rows.Count > 0)
{
for (int j = 0; j < datatable.Columns.Count; j++)
{
if (datatable.Columns[j].DataType == typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
{
ESRI.ArcGIS.ADF.Web.Geometry.Point pnt = (ESRI.ArcGIS.ADF.Web.Geometry.Point)datatable.Rows[0][j];
Map1.CenterAt(pnt);
m_ADFCallbackFunctionString = Map1.CallbackResults.ToString();
return;
}
} }
else
{
object[] ob = new object[1];
string sa = "alert('没有找到该变压器');";
ob[0] = sa;
ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult callbackresult = new ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult(null, null, "Javascript", ob);
Map1.CallbackResults.Add(callbackresult);
m_ADFCallbackFunctionString = Map1.CallbackResults.ToString(); }
}
}
} } }
}
}
论坛签名======================================================================
当您的问题得到解答后请及时结贴.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖如何给自己的回帖中也加上签名?
http://blog.csdn.net/q107770540/archive/2011/03/15/6250007.aspx
{
namespace SetPosByAttr 错误 2 类、结构或接口成员声明中的标记“namespace”无效 {
错误 2 “SetPosByAttr._Default”不实现接口成员“System.Web.UI.ICallbackEventHandler.GetCallbackResult()”
错误 3 “ASP.default_aspx.GetTypeHashCode()”: 没有找到适合的方法来重写
错误 4 “ASP.default_aspx.ProcessRequest(System.Web.HttpContext)”: 没有找到适合的方法来重写
错误 5 “ASP.default_aspx”不实现接口成员“System.Web.IHttpHandler.IsReusable”
这些是怎么回事啊
错误 2 “SetPosByAttr._Default”不实现接口成员“System.Web.UI.ICallbackEventHandler.GetCallbackResult()”
错误 3 “ASP.default_aspx.GetTypeHashCode()”: 没有找到适合的方法来重写
错误 4 “ASP.default_aspx.ProcessRequest(System.Web.HttpContext)”: 没有找到适合的方法来重写
错误 5 “ASP.default_aspx”不实现接口成员“System.Web.IHttpHandler.IsReusable”
这些是怎么回事啊