How to display an Esri Map on MVC view from an HTML file?

1581
1
02-12-2020 05:27 AM
SiyabongaKubeka
Occasional Contributor

I would like to know how to display an Esri Map on a ASP.Net MVC view from an HTML file.

I have an HTML file that contains a JavaScript code. This file can display the map and the widgets when I open it with any internet browser. It is working fine. But now I want to display that map on an ASP.Net MVC view. This is what I have done:

<h2 class="panel-title" data-toggle="collapse" href="#projectmap">Project Map</h2><div id="projectmap" class="panel-collapse collapse">  <div class="panel-body">    <div class="form-group">       @Html.Raw(File.ReadAllText(Server.MapPath("~/Views/Application/default.html")))     </div>  </div></div>

But it displays only the Sketch widget, it does not display the map. I have also tried to write the JavaScript code manually on the .cshtml file and use the div container to display the map, it still displays the Sketch widget only. I have also tried the partial views, it does not work.
0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

I found a similar thread that might be useful: Using ArcGIS API for JavaScript with ASP.Net MVC

And we have a .NET and the Esri JavaScript API place on GeoNet as well that might be helpful.

0 Kudos