Simulating a get form

Last post 09-12-2008 12:03 PM by KDubAZ. 2 replies.

Sort Posts:

  • Simulating a get form

    09-10-2008, 10:45 PM
    • Member
      295 point Member
    • Mainship
    • Member since 01-03-2007, 4:54 PM
    • New York
    • Posts 1,443

    I have a PHP page that I'm converting to ASP.NET.  The page uses a form with a get method to collect address information, and pass that information onto mapquest.  With this form, when you get to mapquest, the collected address is already in the from section of the directions page.

    Using a button and putting the mapquest URL in the postback property, I can get the button to take me to mapquest, but the address information isn't filled in.  Any idea how I can get the address info filled in?

    Diane

  • Re: Simulating a get form

    09-10-2008, 11:45 PM
    • Member
      142 point Member
    • KDubAZ
    • Member since 06-20-2006, 2:00 PM
    • Posts 29

    MapQuest will accept the parameters as part of the of the query string.  There are a few ways you can go about doing this, depending on if you want your user to have to click the search button or not.  First, rather than using the PostBackUrl property, navigate to MapQuest using the button's click handler.  In the button handler add code to do one of the following:

            //params for map
            string mapParams = "city=Redmond&state=WA&address=1+Microsoft+Way&zipcode=98052";
            //params for directions
            string directionParams = "1c=Redmond&1s=WA&1a=1+Microsoft+Way&1z=98052&2c=Mountain+View&2s=CA&2a=1600+Amphitheatre+Parkway+++&2z=94043";
            //redirect and fill in map fields
            Response.Redirect("http://www.mapquest.com?" + mapParams);
            //redirect and fill in direction fields
            Response.Redirect("http://www.mapquest.com?" + directionParams);
            //redirect directly to map without requiring user to click search
            Response.Redirect("http://www.mapquest.com/maps?" + mapParams);
            //redirect directly to directions without requiring user to click get directions
            Response.Redirect("http://www.mapquest.com/maps?" + directionParams);

     

    Hope this helps
     

  • Re: Simulating a get form

    09-12-2008, 12:03 PM
    • Member
      142 point Member
    • KDubAZ
    • Member since 06-20-2006, 2:00 PM
    • Posts 29

     Did you get this working?

Page 1 of 1 (3 items)