求救:如何显示回调结果
自己做了一个imagebutten,激发后读取地图范围,并想把得到的结果显示出来,谁能帮我看看,我为什么不能显示出来,救急!多谢了!!!
public partial class Default : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
{
public string sCallBackFunctionInvocation;
private string mapstring;
public void RaiseCallbackEvent(string eventArgs)
{
if (eventArgs.Contains("zoomtoextend"))
{
ZoomToPointServer();
}
}
public string GetCallbackResult()
{
return mapstring;
}
public void ZoomToPointServer()
{
string XMax =Map1.Extent.XMax.ToString();
string YMax =Map1.Extent.YMax.ToString();
string XMin =Map1.Extent.XMin.ToString();
string YMin =Map1.Extent.YMin.ToString();
string ExtentValue = XMin + ";" + YMin + ";" + XMax + ";" + YMax;
mapstring = ExtentValue;
}
protected void Page_Load(object sender, EventArgs e)
{
sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "processCallbackResult", "context", "postBackError", true);
}
<div>
<script language="javascript">
function ZoomToPointClient()
{
var message = 'zoomtoextend';
var context = 'Map1';
<%=sCallBackFunctionInvocation%>
}
function processCallbackResult(alertContent)
{
alert(alertContent);
}
</script>
</div>
<asp:ImageButton ID="ImageButton1" runat="server" Height="43px" Style="left: 386px;
position: absolute; top: 508px" Width="177px" OnClientClick="ZoomToPointClient();" />