Calling Find multiple times

Last post 7/25/2008 9:51:36 PM by Chris Pietschmann. 12 replies. << Back to Web.Maps.VE v2.0 General
7/4/2008 8:17:59 AM
russellmason

Calling Find multiple times

Hi

Is it possible to call Find from code behind more than once? If I call it several times the FindLoaded event only fires for the last Find called.

I have tried creating new threads for each call but that doesn't work (I guess that this is because we have to return to the client side to call the VE Find and then come back to the server for the event handler). Are there any other workarounds you can think of if this is not possible.

Thanks
Russell Mason

7/4/2008 6:06:02 PM
broomm

Re:Calling Find multiple times

Hi,

I too would like to know a solution / workaround for this please.

Thanks
Mark
7/6/2008 1:00:17 PM
Chris Pietschmann

Re:Calling Find multiple times

Because of the nature of how the Find method works, you can only call it once per Asynchronous Postback. If you need to call it multiple times, you need to wait until the Find results come back to the server from the client, then call Find again with the next search.
7/10/2008 5:40:02 AM
smetri

Re:Calling Find multiple times

How do we do that in the code behind? Also, is there a better way to accomplish the task of mapping a set of addresses all at once.

 

Thanks for all the help,

-Sam

7/10/2008 1:00:07 PM
Chris Pietschmann

Re:Calling Find multiple times

Just call the Find method again in the FindLoaded event handler to fire off the next Find.
7/10/2008 2:48:47 PM
smetri

Re:Calling Find multiple times

Chris,

 

I think that makes sense, but how can I pass information between the two functions (Map1.Find and Map1_FindLoaded) so that FindLoaded could inform the calling function what it just loaded. A simple example could be of great help. Your examples in the example project are very helpful, but I could not find a similar calling back and forth in there.

 

Thanks,

-Sam

7/15/2008 3:05:33 AM
Chris Pietschmann

Re:Calling Find multiple times

A work around to this would be to add a HiddenField to the page within an UpdatePanel, and set the HiddenField's value to some unique ID that you can retrieve during the FindLoaded event. This way you'll be able to tell what Find you performed last, so you know which to perform next.

Let me know if you have any further questions.
7/17/2008 10:06:05 PM
riclo

Re:Calling Find multiple times

Chris,

 

this works, but in my test-project, it looks like the map goes to the starting position every find-action.

so it gives a flash -effect

regards

 

richard loupatty 

7/21/2008 5:55:29 PM
smetri

Re:Calling Find multiple times

Did anyone find a solution to this problem? Does anyone now of another mapping control that would accept a collection of addresses and just map them all at once?

 

Thanks,

-Sam

7/22/2008 3:51:37 AM
Chris Pietschmann

Re:Calling Find multiple times

riclo, If you don't want the map to change location when performing the Find operation, just set the FindArguments.SetBestMapView to False prior to calling the Find method. This should keep your map from "flashing".
7/22/2008 3:54:29 AM
Chris Pietschmann

Re:Calling Find multiple times

smetri, There isn't any other mapping control that I am aware of that allows you to just give it a list of address's for it to plot. Also, the base of this limitation in Web.Maps.VE is due to the fact that Virtual Earth itself cannot take a list of address's to automatically plot without you geocoding them first, either using the FindLocations method or using a third party geocoder.
7/22/2008 7:26:53 PM
riclo

Re:Calling Find multiple times

Chris,

 

Thanks for the hint. But after i'm done with the finding, i want to zoom in, but

with the new

SetBestMapView set to false, it doesn't respond to the zoom.

By the way

Is there an intelligent way of zooming?

what i want is a smart zoom, so the widest pushpin forms a rectangle where the other pushpins ars inside this rectangle. And where the zoom is the rectangle.

 

Richard

7/25/2008 9:51:36 PM
Chris Pietschmann

Re:Calling Find multiple times

Currently the only way to show the "Best Fit" for the shapes that are plotted after all your Find searches have completed is to use JavaScript to call the VEMap.SetMapView method.

There is an example posted at the following link of doing this:
http://simplovation.com/forums/t/01afa2ff-8bc2-4842-9cbb-a67586d00b6b.aspx