Click here to Skip to main content
11,796,631 members (72,996 online)
Rate this: bad
Please Sign up or sign in to vote.
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
Posted 11-Oct-12 5:16am
Edited 11-Oct-12 11:13am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
0 Maciej Los 505
1 Abhinav S 417
2 OriginalGriff 360
3 CPallini 285
4 KrunalRohit 249
0 OriginalGriff 2,012
1 Maciej Los 1,725
2 KrunalRohit 1,310
3 CPallini 1,055
4 ppolymorphe 858

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100