ArcGIS JavaScript API and Razor View (cshtml)

2517
2
Jump to solution
09-24-2012 12:10 AM
VasudevanPeriasamy
New Contributor
Is it possible to use ArcGIS API for JavaScript in ASP.Net MVC4's Razor View?

I am trying to develop a mobile friendly web application with arcgis maps javascript viewer. ASP.Net MVC4 has some great mobile support features with its Razor view engine. Is it possible to integrate ArcGIS maps in cshtml pages? If so, please provide some sample code or references for that.

Thanks.
0 Kudos
1 Solution

Accepted Solutions
__Rich_
Regular Contributor
Is it possible to use ArcGIS API for JavaScript in ASP.Net MVC4's Razor View?

Yes.

I am trying to develop a mobile friendly web application with arcgis maps javascript viewer. ASP.Net MVC4 has some great mobile support features with its Razor view engine.

Which features are you hoping to use?  Nothing in that article needs Razor to achieve it, Razor just happens to be ASP.NET's default scripting language these days so all MS examples tend to be written using it.


Is it possible to integrate ArcGIS maps in cshtml pages?

Yes.  The JS API is a client-side technology so it doesn't matter which server-side technology you use to emit the page content.
If so, please provide some sample code or references for that.
Thanks.

I think it'd be more beneficial to learn what Razor actually is and what it does then you'll see that you don't need any Razor-specific examples for the JS API 🙂

View solution in original post

0 Kudos
2 Replies
__Rich_
Regular Contributor
Is it possible to use ArcGIS API for JavaScript in ASP.Net MVC4's Razor View?

Yes.

I am trying to develop a mobile friendly web application with arcgis maps javascript viewer. ASP.Net MVC4 has some great mobile support features with its Razor view engine.

Which features are you hoping to use?  Nothing in that article needs Razor to achieve it, Razor just happens to be ASP.NET's default scripting language these days so all MS examples tend to be written using it.


Is it possible to integrate ArcGIS maps in cshtml pages?

Yes.  The JS API is a client-side technology so it doesn't matter which server-side technology you use to emit the page content.
If so, please provide some sample code or references for that.
Thanks.

I think it'd be more beneficial to learn what Razor actually is and what it does then you'll see that you don't need any Razor-specific examples for the JS API 🙂
0 Kudos
DanRandolph
New Contributor
Is it possible to use ArcGIS API for JavaScript in ASP.Net MVC4's Razor View?


If you found how to do this, please let me know. So far, I have only found ways to post back to a MVC controller using jQuery.
From there, you can return a json action response.

I don't think you can use any of MVC Razor markup directly in DIVs made up of DOM injected text. This is the model for for the Javascript API to avoid postbacks. Almost all the map interaction is done with DOM injection that is rather easy to do using jQuery.

Forget using any Dojo that you don't have to. It is garbage.

If anyone wants to see how I interact with MVC controllers to get back a json object, just ask.