Click here to Skip to main content
14,691,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have three text fields, zip,city and state.Once the zip code is entered, then automatically the city and state should be auto-filled in the texboxes.
<label>ZipCode</label>@Html.TextBoxFor(x => x.Zipcode)
<label>City</label>@Html.TextBoxFor(x => x.City)
<label>State</label>@Html.TextBoxFor(x => x.State)

how can i do this, can anyone help
Updated 11-Oct-12 12:13pm

1 solution

You need to find some service which provides the ZIP code lookup. As I can see from your profile, you are in U.S., right? So, it could be like this one:[^].

It would be more convenient to get a service with is provided as a Web service. Here is one:[^].

This site provides dual service: you can do the ZIP code lookup through a Web browser as a human operator, or create a Web service client using provided WSDL, which the most convenient way to use the service in your code. I think, you will be able to find other services of this kind. You can do your search and refer to the documentation of the service provider on the services' sites.

If you are given WSDL, as in this case, the solution is quite easy. Please see:[^],[^],[^].

This is some walkthrough article showing how to consume such Web service, with examples:[^].

If, by some reason, you need to use a "regular" Web site oriented for the use of a human operator using the browser, for a lookup of just about anything, you would need to use the techniques of Web scraping:[^].

Please see my past answers:
get specific data from web page[^],
How to get the data from another site[^].

I hope you would not need it, because consuming a Web service is way better.

Good luck,
Sushil Mate 11-Oct-12 12:34pm
my 5 for your effort :)
Sergey Alexandrovich Kryukov 11-Oct-12 12:38pm
Thank you, Sushil.
fjdiewornncalwe 11-Oct-12 17:13pm
+5. Excellent.
Sergey Alexandrovich Kryukov 11-Oct-12 17:16pm
Thank you, Marcus.
Member 9359591 12-Oct-12 12:19pm
thnq so much..
Sergey Alexandrovich Kryukov 12-Oct-12 12:36pm
You are welcome.
Are you going to accept it formally (green button)?
Member 9359591 24-Oct-12 19:44pm
yes i did..
Sergey Alexandrovich Kryukov 24-Oct-12 21:30pm
Great, thanks.
Good luck, call again.
Member 9359591 25-Oct-12 13:29pm
Thank you and good luck to you to..
Sergey Alexandrovich Kryukov 25-Oct-12 14:57pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900