Hi Manish,
Thank you for your response. I tried layer.layerDefinitions, I got none.
I also want to mension that in the service, there is no layer definition. But I set the layer definition in Javascript code early. Then I want to get this layer definition for print.
===========
dojo.forEach(map.layerIds, function(layer, i1){
var ml = map.getLayer(layer);
switch (ml.declaredClass) {
case "esri.layers.ArcGISDynamicMapServiceLayer":
var s = dojo.forEach(ml.layerInfos, function(sublayer, i2){
if (dojo.indexOf(ml.visibleLayers, sublayer.id.toString()) !== -1) {
alert(sublayer.name);
alert(sublayer.id);
alert(sublayer.layerDefinitions);
visiblelayers[sublayer.name] = true;
layerQuery[sublayer.name] = sublayer.layerDefinitions;
}
else {
visiblelayers[sublayer.name] = false;
}
});
===============
But sublayer.layerDefinitions gives Null.
Thank you very much for your help.
Cindy