Reimers.dk

.NET, AJAX and Google APIs brought together
Welcome to Reimers.dk Sign in | Join | Help
in Search

Change information in the Text Box

Last post 01-21-2010, 14:40 by rongdiencuong. 1 replies.
Sort Posts: Previous Next
  •  01-20-2010, 15:20 2952

    Change information in the Text Box

    Hi

     I have a gooleMap Control and 4 control TextBox(latitude, longitude, address, country). I let 4 controls TextBox, in the UpdatePanel.
    When i click on the Map, in the GMap_Click handler, i modify the text in the 4 control, but it dont show up. The Code is like this:

    <asp:UpdatePanel Id="UpdatePanel1" runat="server" UpdateMode="Always">

    <ContentTemplate>

    <table> <tr><td>Address</td><td>

    <asp:TextBox id="TbAddress1" Width="300px" runat="server" AutoPostBack="true"/>

    </td>

    </tr>

     

    <tr><td>Country</td><td>

    <asp:TextBox AutoPostBack="true" runat="server" id="TbCountry1" maxlength="25" />

    </td>

    </tr>

    <tr>

    <td>Latitude</td>

    <td>

    <asp:TextBox id="TbLatitude1" AutoPostBack="true" maxlength="25" runat="server"/>

    </td>

    </tr>

    <tr>

    <td>Longitude</td>

    <td>

    <asp:TextBox runat="server" id="TbLongitude1" maxlength="25" AutoPostBack="true"/>

    </td>

     

    </tr>

    <tr>

     

    <td>

    <asp:Button ID="btnAdd" runat="server" Text="Add" />

    </td>

    </tr>

    </table>

    </ContentTemplate>

    </asp:UpdatePanel>

    </td>

    <td>

    <Reimers:GoogleMap ID="GMap" Width="500px" Height="300px" runat="server" />

    </td>

    </tr>

    </table>

    void GMap_Click(object sender, CoordinatesEventArgs e)

    {

    GoogleMarker gm1 = new GoogleMarker("Marker "+j.Next(), e.Coordinates.Latitude, e.Coordinates.Longitude);

    e.MapCommand = e.Map.AddOverlay(gm1, true);

    TbLatitude1.Text = e.Coordinates.Latitude.ToString();

    TbLongitude1.Text = e.Coordinates.Longitude.ToString();

    GoogleResult result = GoogleGeocoder.ReverseGeocode(e.Coordinates, ((GoogleMap)FindControl("GMap")).GoogleKey);

    string address = null;

    string country = null;

    foreach (Location loc in result.Locations)

    {

    address = loc.Address.Street + " " + loc.Address.Zip + " " + loc.Address.City + " " + loc.Address.Region;

    country = loc.Address.Country;

    break;

    }

    TbCountry1.Text = country;

    TbAddress1.Text = address;

    }

     Do someone know how to make the change show up in the text Box?

    Best Regard

  •  01-21-2010, 14:40 2957 in reply to 2952

    Re: Change information in the Text Box

    I read this blog post many times but i have just realized now that it respond to my question:

    http://www.reimers.dk/blogs/jacob_reimers_weblog/archive/2008/11/23/an-example-using-updatepanels-and-google-maps.aspx

     Maybe it's because i m a newbie that i didnt realize it at first

View as RSS news feed in XML