I have a table that has information of fire departments around the state. I am trying to set up the gridview so that the address is a hyperlink with google maps. For example, In my address column, I have an address such as 745 W Colfax Ave Denver CO 80204, I want to change it so the DataNavigateUrlFormatString would read "https://maps.google.com/maps?q=" + the address with the spaces replaced with a '+' symbol so it would end up being like this 745 W Colfax Ave Denver CO 80204. Here's my ASP.Net code snippet:

    <asp:BoundField DataField="resource" HeaderText="Resource" />
    <asp:BoundField DataField="name" HeaderText="Name" />
    <asp:BoundField DataField="description" HeaderText="Description" />
    <asp:BoundField DataField="kind" HeaderText="Kind" />
    <asp:BoundField DataField="type" HeaderText="Type" />
    <asp:HyperLinkField DataNavigateUrlFields="address" DataNavigateUrlFormatString="https://maps.google.com/maps?q=745+W+Colfax+Ave+Denver+CO+80204" DataTextField="address" HeaderText="Address" />

How do I go about doing this?


5 Years
Discussion Span
Last Post by JorgeM

That seems to work good. I guess Google Maps does not really need the + between each string in the address. Thanks!


Good to hear. Feel free to mark the thread as solved if you do not need additional help.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.