I've been able to display a map just fine. However I am having problems adding a graphic to it.I first tried to just to do a map.graphics.add() and the graphics object is null (see graphic-null.jpg).So to work around that I tried to create a graphics layer and then add the graphic to that, but got an error about the _gc.surface being null when trying to add the layer.The maps show up just fine when I don't try to add them. A breakpoint in the js shows that it's getting the homePoint values. I've looked through various samples to see that my code is the same and I don't see a difference. But I'm sure I'm missing something, as those work and mine doesn't.In ASP.MVC code:<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/tundra/tundra.css" />
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" type="text/javascript"></script>
<script type="text/javascript">
var homePoint = new esri.geometry.Point(@Model.Data.HomeLon, @Model.Data.HomeLat);
</script>
In my js file (kept seperate for SoC preference)var hMap;
dojo.require("esri.map");
dojo.require("esri.layers.graphics");
dojo.addOnLoad(initMaps);
function initMaps() {
homeExtent = new esri.geometry.Extent(homePoint.x - 0.5,
homePoint.y - 0.5,
homePoint.x + 0.5,
homePoint.y + 0.5);
hMap = new esri.Map("homeMap", { extent: homeExtent, logo: false });
var basemapURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
hMap.addLayer(basemap);
}
Thanks for the help!!