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 102579
In Process

The Archive Base Latest Questions

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

Background I have a page on my ASP.NET MVC web app for users to

  • 0

Background

I have a page on my ASP.NET MVC web app for users to enter addresses into their address book. When the user enters in their address and clicks the submit button, the controller action that handles the form post then geocodes the address (retrieves latitude, longitude, and the full address in case the user forgot to enter in their state, zip code, etc.).

Now, it’s entirely possible that the user didn’t enter in enough information to get an exact match. In this event, the geocode service returns a list of best matches for the address specified. When this happens, I want to prompt the user with this list of best matches so that they can select which address they wish to use.

This is all working wonderfully. I store the list of best matches in the ViewData, and the page renders the items in the list as an unordered list if they are provided. Next to each of the addresses is a ‘Select’ link which the user can use to select the address they wish to use. The ‘click’ event of the ‘Select’ link is hooked up using jQuery to replace the text in the original address textbox with the address the user is selecting and then click the submit button via javascript.

The Problem

When the user selects an address, I want my controller action to check if the address is already in their address book. If it is, then I want to return an error message indicating that this address already exists. I also want to re-render the list of possible addresses for the user to select from (e.g. if the user originally saw a list of 3 addresses to pick from and they choose one that was already in their address book, the page should show an error message and the 3 addresses to pick from again). How can I re-render the list of best matches without making another call to the geocoding service in my controller action?

In other words, I have an unordered list that was generated by the last controller action that I want to display to the user again. The items in the list were rendered as text strings and therefore aren’t posted to my controller action. The only way I have been able to solve this so far is to store the list of address matches in session. Am I missing something or is that the way I should be going about this?

With an ASP.NET web forms application, I could simply store the best matches in ViewState and it would be available to me on the postback from the user selecting the address. Is there a similar mechanism for ASP.NET MVC?

  • 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:59:17+00:00Added an answer on May 11, 2026 at 12:59 am

    You could use an AJAX request to your controller that will verify if the address already exists and if it does only update the error message container of the page. This way the already rendered list of matches will stay intact.

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

Related Questions

Loading...

Sidebar

Ask A Question

Stats

  • Questions 54k
  • Answers 54k
  • 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 since master page is like a control embedded in a… May 11, 2026 at 7:32 am
  • added an answer This seems to be a genuine bug. It works as… May 11, 2026 at 7:32 am
  • added an answer There is no prefix convention that Adobe recommends since they… May 11, 2026 at 7:32 am

Top Members

Trending Tags

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

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.