krister

Cant access the properties of a FeatureLayer

Discussion created by krister on Oct 7, 2010
Latest reply on Oct 11, 2010 by krister
Hi!
I´m working with ArcGIS Server 10 and the JavaScript API v2.1 and I'm trying to access the properties (name, fields etc) of a featureLayer but it seems like I get no reference to the featureLayer. When I try to alert the name (... or other properties) i get "undefined". This is kind of what I´m doing in code (JavaScript)...

var featureLayer=new esri.layers.FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1", {mode: esri.layers.FeatureLayer.MODE_SELECTION});

alert(featureLayer.name);

Am I missing something... ??

Outcomes