Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 100405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:34:24+00:00 2026-05-11T00:34:24+00:00

I currently have a user control that is used on both an /Address/Edit and

  • 0

I currently have a user control that is used on both an /Address/Edit and an /Address/Create page. This user control simply has the following code in it to submit a new address to the system:

<%      using (Html.BeginForm())     { %>         <table>             <tr>                 <td>Street Address</td>                 <td>                     <%= Html.TextBox('StreetAddress', (ViewData.Model != null) ? ViewData.Model.StreetAddress : '') %>                     <%= Html.ValidationMessage('Address.StreetAddress') %>                 </td>             </tr>         </table>         <%= Html.SubmitButton() %>         <%             if (ViewData['GeocodeResults'] != null) {         %>                   <p>                 Google maps found the following addresses that matched the address you entered.  Please select                 the appropriate address.  If none of these addresses are correct, try reentering the address                 again and be as specific as possible.             </p>             <ul>                 <%                      foreach (GeocodeResult geocodeResult in (List<GeocodeResult>)ViewData['GeocodeResults']) {                  %>                         <li>                             <%= geocodeResult.StreetAddress %>                         </li>                 <%                     }                  %>             </ul>         <%               }          %> <%     } %> 

To summarize the code above, what it does is in the controller, it queries Google Maps to geocode the address in the text box (i.e. turns it into a set of longitude/latitude coordinates). When Google Maps returns more than one result, I store off these results into ViewData[‘GeocodeResults’], which will then display the possible addresses to the end user.

Now, this is working fine for displaying the addresses, but what I really want is that list to be rendered as a list of hyperlinks so that the user can click on the appropriate address and the form will submit with that address instead of the one in the textbox. Is there any way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:34:24+00:00Added an answer on May 11, 2026 at 12:34 am

    Something like:

    <a href='javascript:void(0);' onclick='submitAddress(this);'>     <%= geocodeResult.StreetAddress %></a> 

    where you have

    function submitAddress(link) {    $('input#streetAddress:first').text(link.innerHtml);    $('input#submit').click(); } 

    You could also drop it in a hidden field that would signify that you don’t need to do the Google map search for this address. That is, if HiddenStreetAddress is provided, just use with without lookup. If not, then do Google lookup on StreetAddress. If more than one result, then display results. If not, then use provided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Yes, a WPF application can host a WCF client just… May 11, 2026 at 2:58 pm
  • added an answer So, if I understand you correctly, you have some xml… May 11, 2026 at 2:58 pm
  • added an answer CGI is what you want; it will let you embed… May 11, 2026 at 2:58 pm

Related Questions

I have a simple form on a view page, implemented as a user control,
Summary: How can I determine TFS source control configuration for a local folder. Explanation:
I asked a question about interfaces previously and got some excellent responses. I'm really
I'm building a heavily CRUD based ASP.NET website and I've got to the phase

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.