Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Javascript setTimeout while loading from XML into Google Maps -


i have been struggling code quite time. loading xml google maps , geocoding addresses xml. need add delay code when there many addresses @ once.

here entire code doing this

i need have load xml file delay, loads @ once , geocoder can not handle many requests when xml large. xml file changing continuously needs reloaded , re-geocoded. becomes problem when xml file becomes larger, when need work most.

i have placed delay around geocoder.getlocations(address,createmarker); address variable contains addresses not delay it. if place delay around var address = markers[i].getattribute("address"); not pass i variable function. can give appreciated.

    // create marker     function createmarker(response)      {          var place = response.placemark[0];         var point = new glatlng(place.point.coordinates[1],                                     place.point.coordinates[0]);         var marker = new gmarker(point);         gevent.addlistener(marker, "click",function()             {                 marker.openinfowindowhtml(place.address);             });             map.addoverlay(marker);     }        // create new map object        var map = new gmap2(document.getelementbyid("map"));          map.addcontrol(new gsmallmapcontrol());        map.addcontrol(new gmaptypecontrol());        map.enablescrollwheelzoom();        map.addmaptype(g_physical_map);        map.setcenter(new glatlng(49.923068,-119.437981), 10);        var geocoder = new gclientgeocoder();       // download data in active.xml     gdownloadurl("active.xml", function(data)      {          var xml = gxml.parse(data);         var markers = xml.documentelement.getelementsbytagname('inc');         settimeout( function()             {     (var = 0; < markers.length; i++)             {         var address = markers[i].getattribute("address");                        geocoder.getlocations(address,createmarker);                     }             },200);              }); 

try:

for (var = 0; < markers.length; i++) {   var address = markers[i].getattribute("address");             function (inneraddress, j) {       settimeout(function() {         geocoder.getlocations(inneraddress,createmarker);           }, 200 * j);   }(address, i); } 

this should space out requests geocoder.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -