Posted by david on 24. November 2008 08:21
current sandpit is the shape counting.
scenario:
open up page. click add hurricane. layer count increments by one, shape count does not.
sometimes, after adding ageo, the count will come up. but only for the last add.
current hypothesis:
there is a delay, a lag, when loading shapes, esp by importing into a layer. the call to the update counts code is happening before the lag. so update counts doesn’t see the shapes yet.
so, going to try using the callback function on the ImportShapeLayer
ok, scratch that, seems to be a lot of controversy about using those
but this guy says its ok …
Matt Berseth ASP.NET AJAX Invoke a static method from script
first efforts failed …
I did confirm that the delay is causing the problem: i threw another button on the page attached to the update method … adding a layer did not correctly increment the shape count, but the update button did.
Why do ASP.NET AJAX page methods have to be static Encosia but static page methods dont have access to controls.
Ok – to summarize: the original problem was that shapecount was not correct. update counts is called immediately after the add layers methods. importing takes time & the lag causes the update count to miss the newly added shapes.
My first response was to try and call the update method from javascript. but pagemethods cannot access the controls, which is what i’m trying to do, update the control with the counts.
Second response was to double check that there was indeed a lag & that an update of the counts – after the import acutally completed – worked.
Since I don’t feel like jumping into the pagemethod stuff, if that is even the ultimate solution, I’m going to code the count updates client side in javascript. Hopefully there won’t be any issues with the other server side counts.
Importing and Mapping Data
Keith Kinnan's Blog Virtual Earth API GeoRSS Layers
How do you get client side instance of asp.net map control Virtual Earth Map Control Development