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

  • SEARCH
  • Home
  • 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

Related Questions

Currently I have a User table that has a toys_owned column that is an
I currently have form that checks if a user has unsubmitted changes when they
I have an issue currently that I can't resolve. I have a user control
I have a user control 'A' that has another user control 'B' as its
I have a user control which displays the currently logged in user's name. I
I currently have two different models: User and Project . The User model has
I have a data entry web app where the control that has focus is
I currently have a couple different user controls that provide the same functionality: three
I currently have a form that has a completely transparent background. At the moment
What is the preferred/easiest way to find the control that is currently receiving user

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.