Hello guys, Actually my goal was to achieve this functionality using Web ADF JavaScript not using the ArcGIS JavaScript i.e dojo.I got success in implementing drag graphics functionality with the real user experience when user dragging the graphics.I am posting my code here if it help someone :ar map;
var mapID = 'Map1';
var graphicCount = 0;
var drawstopflag = false;
var drawRouteFlag = false;
var maptipTitle;
var dragMode = false;
function initialize() {
// $find is a shortcut method offered by the ASP.NET AJAX JavaScript Library for
// retrieving JavaScript objects that have been registered as components with the
// AJAX framework (i.e. either by having been created via $create or explicitly
// registered via Sys.Application.addComponent
map = $find(mapID);
// map.add_onProgress(customProgress);
// Show map coordinates in status bar based on cursor location
map.add_mouseMove(mouseMove);
map.add_mouseDragCompleted(mouseDragCompleted);
map.add_mouseDragging(mouseDragging);
if (drawRouteFlag) {
drawRoute();
drawGeometry(geom, "Route");
}
if (drawstopflag) {
drawstops();
}
}
var thegraphic;
function mouseDragging(sender, eventArgs) {
// if (ESRI.ADF.Geometries.Point.isInstanceOfType(eventArgs.element.get_geometry())) {
if (currentelement != null) {
currentelement.set_geometry(eventArgs.coordinate);
// currentelement._parent.get_mapTips()._currentHighlight.set_geometry(evenArgs.coordinate);
// map.refresh();
}
// }
}
function mouseDragCompleted(sender, evenArgs) {
var tool = $find("Toolbar1");
// if (ESRI.ADF.Geometries.Point.isInstanceOfType(eventArgs.element.get_geometry())) {
if (currentelement != null) {
currentelement.set_geometry(evenArgs.coordinate);
if (ESRI.ADF.Geometries.Point.isInstanceOfType(currentelement.get_geometry()) & currentelement._attributes["FeatureId"] == "dragStop") {
__doPostBack("Map1Drag", evenArgs.coordinate.coordinates[0] + '#' + evenArgs.coordinate.coordinates[1]);
}
else if(ESRI.ADF.Geometries.Point.isInstanceOfType(currentelement.get_geometry()) & currentelement._attributes["FeatureId"].startsWith("Stop"))
{
__doPostBack("StopDrag", currentelement._attributes["FeatureId"] + "#" + evenArgs.coordinate.coordinates[0] + '#' + evenArgs.coordinate.coordinates[1]);
}
}
//}
}
function drawGeometry(geometry, id) {
map = $find(mapID);
var highlightSymbol = null;
var defaultSymbol = null;
var graphicFeatureGroupID = null;
// Initialize the graphic feature's symbol and graphicFeatureGroup ID based on the passed-in geometry type
if (ESRI.ADF.Geometries.Point.isInstanceOfType(geometry)) {
defaultSymbol = new ESRI.ADF.Graphics.MarkerSymbol(defaultImage, 16, 24, 'hand');
// defaultSymbol.set_height(24);
// defaultSymbol.set_width(32);
highlightSymbol = new ESRI.ADF.Graphics.MarkerSymbol(hightlightImage, 16, 24, 'hand');
// highlightSymbol.set_height(24);
//highlightSymbol.set_width(35);
graphicFeatureGroupID = "pointGraphics";
}
else if (ESRI.ADF.Geometries.Polyline.isInstanceOfType(geometry)) {
defaultSymbol = new ESRI.ADF.Graphics.LineSymbol('blue', 3, 'hand');
highlightSymbol = new ESRI.ADF.Graphics.LineSymbol('yellow', 3, 'hand');
graphicFeatureGroupID = "lineGraphics";
}
else if (ESRI.ADF.Geometries.Polygon.isInstanceOfType(geometry)) {
defaultSymbol = new ESRI.ADF.Graphics.FillSymbol('white', 'red', 3, 'hand');
defaultSymbol.set_opacity(.5);
highlightSymbol = new ESRI.ADF.Graphics.FillSymbol('yellow', '#00ffff', 3, 'hand');
highlightSymbol.set_opacity(.5);
graphicFeatureGroupID = "polygonGraphics";
}
var attributes = { "valueInTextbox": "test", "FeatureId": id }
// Try retrieving the graphicFeatureGroup (i.e. layer) with the ID corresponding to the current
// geometry type. If the group is not found, create it.
var graphicFeatureGroup = $find(graphicFeatureGroupID);
if (!graphicFeatureGroup) {
// Create map tips to associate with the graphic features
var mapTips = new ESRI.ADF.UI.MapTips();
// Set the hover template, which will show as the title of the mapTips
mapTips.set_hoverTemplate("<b><nobr>Dynamic Map Tip</nobr></b>");
// Set the content template, which will show when the mapTip is clicked. When the mapTip is
// rendered, (@valueInTextbox} will be replaced by the value of the corresponding graphicFeature's
// "valueInTextbox" attribute, which is actually a property of the same name on the object stored
// in the graphicFeature's attributes property.
mapTips.set_contentTemplate('<span>Value in text box: <b>{@valueInTextbox}</b></span>')
mapTips.set_animate(true);
mapTips.set_maxheight(200);
mapTips.set_width(null);
// Create the graphic feature group with the ID, symbols, and mapTips. Also, wire the
// onMouseOverGraphics and onMouseOutGraphics to the group's mouseOver and mouseOut events
graphicFeatureGroup = $create(ESRI.ADF.Graphics.GraphicFeatureGroup, { "id": graphicFeatureGroupID,
"symbol": defaultSymbol, "highlightSymbol": highlightSymbol
//, "mapTips": mapTips
},
{ "mouseOver": onMouseOverGraphics, "mouseOut": onMouseOutGraphics });
// Add the new graphic feature group to the map
map.addGraphic(graphicFeatureGroup);
// mapTips.get_callout().show();
}
// Get the text from the textbox
//var textInputValue = $get('textInput').value;
// Initialize a JavaScript object with a property called "valueInTextbox" that has
// the value retrieved from the textbox
// Increment the graphicCount variable, which will be used in creating the graphicFeature's ID
graphicCount += 1;
// Create the graphic feature with a unique ID made up of the graphicFeatureGroupID and the graphicCount;
// the passed-in geometry; and the attributes object that specifies the valueInTextbox attribute
var graphicFeature = $create(ESRI.ADF.Graphics.GraphicFeature, { "id": graphicFeatureGroupID + "_" + graphicCount,
"geometry": geometry, "attributes": attributes
});
// Add the graphic to the group
graphicFeatureGroup.add(graphicFeature);
}
ThanksLala Rabari