laptop and a wrench

Bug

The Zoom in and Zoom out tools can fail to work within the ASP.NET MultiView control.

Last Published: August 25, 2014 No Product Found
Bug ID Number NIM010242
SubmittedJuly 10, 2007
Last ModifiedJune 5, 2024
Applies toNo Product Found
Version found9.2
Program languageC#
StatusWill Not Be Addressed

Additional Information

No Public Explanation

Workaround

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

Steps to Reproduce

Bug ID: NIM010242

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options