AnsweredAssumed Answered is null (and likely related 'this._gc.surface' is null )

Question asked by mliebster on Jan 11, 2011
Latest reply on Apr 12, 2011 by andreashoogeveen
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 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="" />
<script src="" type="text/javascript"></script>

<script type="text/javascript">
    var homePoint = new esri.geometry.Point(@Model.Data.HomeLon, @Model.Data.HomeLat);    

In my js file (kept seperate for SoC preference)

var hMap;


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 = ""
    var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);

Thanks for the help!!