The Zoom in and Zoom out tools can fail to work within the ASP.NET MultiView control.
上次发布: August 25, 2014No Product Found
漏洞 ID 编号
NIM010242
已提交
July 10, 2007
上次修改时间
June 5, 2024
适用范围
No Product Found
找到的版本
9.2
编程语言
C#
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
No Public Explanation
解决办法
Set the "EnablePostBack" property of each ToolbarItem in the toolbar control to "True". This will make the tools to work properly whether the view is active or not.But this workaround loses AJAX ability. Another workaround is to create a custom zoom in/out tool. Please follow the steps:1. Add a div tag around the map control, and define the mousedown and mouseUp events:<div onmousedown="corner1();" onmouseup="corner2();"><esri:Map....></div>2. Add two JS functions inside head tags<head id="Head1" runat="server"><script language=javascript type="text/javascript"> var xvalue1;var yvalue1;var xvalue2;var yvalue2;function corner1(){getXY(window.event);//(10,120) is the pixel value of the position of the upper left corner of the map controlxvalue1=mouseX-10;yvalue1=mouseY-120;}function corner2(){getXY(window.event);xvalue2=mouseX-10;yvalue2=mouseY-120;var map = Maps['Map1'];if (map.mode == 'Tool') { var message = xvalue1 + ',' + yvalue1 +',' + xvalue2 +','+ yvalue2;WebForm_DoCallback('__Page',message,processCallbackResult,null,null,true);} }</script> </head>3. On server side, implement ICallbackEventHandler interface as: #region ICallbackEventHandler Members public string GetCallbackResult() { Map1.Refresh(); return Map1.CallbackResults.ToString(); } public void RaiseCallbackEvent(string eventArgument) { //user may draw the rectangle from lower to upper, you should consider it. //The sample only shows when user draws it from upper left to lower right direction. string[] coordValues = eventArgument.Split(','); int x1= Convert.ToInt16(coordValues[0]); int y1= Convert.ToInt16(coordValues[1]); int x2= Convert.ToInt16(coordValues[2]); int y2= Convert.ToInt16(coordValues[3]); //RectangleEventArgs rectargs = (RectangleEventArgs)args; System.Drawing.Rectangle myrect = new System.Drawing.Rectangle(x1, y1, x2 - x1, y2 - y1); ESRI.ArcGIS.ADF.Web.Geometry.Point minpnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(myrect.Left, myrect.Bottom, Map1.Extent, (int)Map1.Width.Value, (int)Map1.Height.Value); ESRI.ArcGIS.ADF.Web.Geometry.Point maxpnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(myrect.Right, myrect.Top, Map1.Extent, (int)Map1.Width.Value, (int)Map1.Height.Value); ESRI.ArcGIS.ADF.Web.Geometry.Envelope mappoly = new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(minpnt, maxpnt); Map1.Extent = mappoly; } #endregion