Apr 19, 2010

How to set a Navigation tool as active tool on page load in MaxExtrem 6.8.0

Set Zoom-In Tool as Active Tool on Page Load:
Usually the sample applications that map extreme provide have no tools set as a default active tool.
We need to select the tool(say ZoomIn tool or Zoom out etc as per our requirements). But while developing applications for customer requirement we may need to set some tool as active tool so as to simply the customer process.

Below is the method used to set the Zoom-In tool as the Active tool on page load.
private void SetActiveTool(string toolName)
        string activateCode = String.Format("{0}Tool.Activate();", "ctl00$ContentPlaceHolder1$" + toolName);
        string activateScript = String.Format("<script type='text/javascript'>AppendScriptToForm('{0}');</script>", activateCode);
        Page.RegisterStartupScript("Key1", activateScript);

The above code applies for the Master Pages. You can directly provide the tool name in normal page scenario.

No comments: