<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: function not defined in map js file in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/function-not-defined-in-map-js-file/m-p/198567#M18419</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nadir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;This is more of an ASP.net question but your issue is that you are trying to call the code from the aspx page html instead of the pages code behind Page_Load event.&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;ButtonName&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Attributes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"onclick"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;layerVisibility&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"LayerName"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or there are a couple of other ways to do this in ASP.net&lt;/P&gt;&lt;PRE class="line-numbers language-markup"&gt;&lt;CODE&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="namespace token"&gt;asp:&lt;/SPAN&gt;Button&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;runat&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;server&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;next&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;OnClientClick&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;layerVisibility(&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;LayerName&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;,true);&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Jun 2019 00:43:23 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2019-06-16T00:43:23Z</dc:date>
    <item>
      <title>function not defined in map js file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/function-not-defined-in-map-js-file/m-p/198566#M18418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have two files in asp,net project.one is pure js file in which i defined all the map related function in dojo style library.Other file is .aspx page.In html part i am calling one function which is defined in map js file.After calling it always throuh me the error function not defined.&lt;/P&gt;&lt;P&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="WebApplication1.Home" %&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;BR /&gt;&amp;lt;head &amp;gt;&lt;BR /&gt; &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;&lt;BR /&gt; &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /&amp;gt;&lt;BR /&gt; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" /&amp;gt; &lt;BR /&gt; &amp;lt;title&amp;gt;Asset View&amp;lt;/title&amp;gt;&lt;BR /&gt; &lt;BR /&gt; &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.28/dijit/themes/claro/claro.css" /&amp;gt;&lt;BR /&gt; &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.28/esri/css/esri.css" /&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://js.arcgis.com/3.28/"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt; &amp;lt;script src="Scripts/MapScript.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&amp;nbsp; //Map Script file&lt;BR /&gt; &amp;lt;script src="https://Code.jquery.com/jquery-1.12.4.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;lt;link href="Content/Style.css" rel="stylesheet" /&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt; &amp;lt;div style="height:100%;background-color:white;width:100%;position:fixed" &amp;gt;&lt;BR /&gt; &amp;lt;div style="position: fixed;&lt;BR /&gt; margin-top: 0px;&lt;BR /&gt; margin-right: 0px;&lt;BR /&gt; z-index:999;&lt;BR /&gt; height:100px;&lt;BR /&gt; width:100px;&lt;BR /&gt; background-color:aquamarine "/&amp;gt;&lt;BR /&gt; &amp;lt;div id="MapDiv" class="MapDiv"&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="AttributeDiv" class="AttributeDiv"&amp;gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/div&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;div id="TblDiv" class="TblDiv"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;lt;button id="btn" &amp;gt;CLick ME&amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;/div&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;$(document).ready(function () {&lt;/P&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px 0.5em !important;"&gt;&lt;CODE style="color: #333333; background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;$( &lt;SPAN class="" style="color: #dd1144;"&gt;"#&lt;SPAN style="color: #3d3d3d;"&gt;btn&lt;/SPAN&gt;"&lt;/SPAN&gt; ).click(&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;() {&lt;/CODE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px 0.5em !important;"&gt;&lt;CODE style="color: #333333; background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt; &lt;/CODE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px 0.5em !important;"&gt;&lt;CODE style="color: #333333; background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;&lt;STRONG&gt;layerVisibility&lt;/STRONG&gt;("LayerNAme",true);&amp;nbsp; &lt;STRONG&gt;//THis function is defined .mapScript.js file. Error on this line function not defiined.&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/DIV&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px 0.5em !important;"&gt;&lt;CODE style="color: #333333; background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;&lt;/CODE&gt;&lt;/DIV&gt;&lt;DIV class="" style="background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px 0.5em !important;"&gt;&lt;CODE style="color: #333333; background: none !important; font-weight: normal !important; font-size: 1em !important; margin: 0px !important; padding: 0px !important;"&gt;});&lt;/CODE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;///Map JS file&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var map;&lt;BR /&gt;var basemap;&lt;BR /&gt;var dynamicMapServiceLayer;&lt;BR /&gt;var RestServiceUrl;&lt;BR /&gt;var featureServiceValidURl;&lt;BR /&gt;var featureServiceRenewalURl;&lt;BR /&gt;var featureServiceExpiredURl;&lt;BR /&gt;var featureServiceBlockedURl;&lt;BR /&gt;var app = {};&lt;BR /&gt;require(["dojo/dom", "dojo/on", "dijit/registry", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/map", &lt;BR /&gt; "esri/layers/FeatureLayer","esri/layers/ImageParameters", "dojo/parser", "esri/tasks/QueryTask", "esri/tasks/query", "esri/graphic", "dojo/domReady!"&lt;BR /&gt;], function (dom, on, registry, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, Map, FeatureLayer, ImageParameters, parser, QueryTask, Query, GraphicMap) {&lt;BR /&gt; parser.parse();&lt;BR /&gt; var streetsService = "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;map = new Map("MapDiv", {&lt;BR /&gt; basemap: "osm"&lt;BR /&gt; zoom: 6,&lt;BR /&gt; center: [46.66, 24.72] // longitude, latitude&lt;BR /&gt; });&lt;BR /&gt; map.on("load", mapLoaded);&lt;BR /&gt; var imageParameters = new ImageParameters();&lt;BR /&gt; imageParameters.format = "jpeg"&lt;BR /&gt; function mapLoaded() {&lt;BR /&gt; var featureLayer = new FeatureLayer(featureServiceRenewalURl, { mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] });&lt;BR /&gt; map.addLayer(featureLayer);&lt;BR /&gt; }&lt;BR /&gt; var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://0.0.00:6080/arcgis/rest/services/UpdateLicenes/MapServer",&lt;BR /&gt; { "opacity": 0.5, "&lt;SPAN&gt;imageParameters&amp;nbsp;&lt;/SPAN&gt;": imageParameters }&lt;BR /&gt; );&lt;BR /&gt; map.addLayer(dynamicMapServiceLayer);&lt;BR /&gt; &lt;BR /&gt; //**********************************************************************************************************************//&lt;BR /&gt;&lt;STRONG&gt;function layerVisibility( strLAyerName,BLFlag) {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; alert("gggggggggg");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; }&lt;/STRONG&gt;&lt;BR /&gt; //**********************************************************************************************************************//&lt;BR /&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Jun 2019 11:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/function-not-defined-in-map-js-file/m-p/198566#M18418</guid>
      <dc:creator>NadirHussain</dc:creator>
      <dc:date>2019-06-15T11:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: function not defined in map js file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/function-not-defined-in-map-js-file/m-p/198567#M18419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nadir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;This is more of an ASP.net question but your issue is that you are trying to call the code from the aspx page html instead of the pages code behind Page_Load event.&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;ButtonName&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Attributes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"onclick"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;layerVisibility&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"LayerName"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or there are a couple of other ways to do this in ASP.net&lt;/P&gt;&lt;PRE class="line-numbers language-markup"&gt;&lt;CODE&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="namespace token"&gt;asp:&lt;/SPAN&gt;Button&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;runat&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;server&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;next&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;OnClientClick&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;layerVisibility(&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;LayerName&lt;SPAN class="punctuation token"&gt;'&lt;/SPAN&gt;,true);&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Jun 2019 00:43:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/function-not-defined-in-map-js-file/m-p/198567#M18419</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-06-16T00:43:23Z</dc:date>
    </item>
  </channel>
</rss>

