[View
demo of inline postcode selection list using AJAX]
The above functionality can be installed in minutes....in 5 easy
steps.....
The
above Postcode Lookup for full Address search functionality can be added to a
ASP.NET web
page in minutes, by simply dropping the supplied files into your
ASP.NET project.
Advantages
-
"Out of the box"
Full Postcode Address Search solution
-
Very little
programming required, easily customised by editing file
simple parameters.
-
Quick
to install, drop supplied files into ASP.NET Project
-
Easily
customisable
window, [More
Info]
-
Will
run on most Web servers
-
Not
blocked by Pop-up blockers
-
Data always up
to date
-
No Data
Administration Cost for you
[AJAX
Inline Version] [Classic
ASP
version of this] [PHP
version of this]
Step1: Download the Example Code
Simply
download the code. The code is in the "VBNET 2005 Full Address Web Popup"
directory of our example downloads. Then
drag and drop the directories "SimpLookup1" and "SimplyLookupImages",
to your own ASP.NET Web Project (same directory as the page as you
want to add the Postcode Lookup Pop-up too
[Click
here to download the Examples]
Example of copying the code into your project
For
example, if we want to add Postcode Lookup Pop-up to a quote
system "Quoteme.aspx" page, which is directory
"A2Quote", then we drop the directories in to achieve:

"off.gif"
and "on.gif" have nothing to do with the Postcode
Popup.
Step 2 : Add our code to your page .aspx page
Then
on your own web page, "Quoteme.aspx" in our example,
we add just
above </body> tag:
Example include the Postcode Lookup window code in your page
<!--#include
file="Simplylookup1/PopupWindowCode.htm" -->
Note:
If you are using a "Master Page", then place in
include statement in the Master Page.
Step 3 : Add a Link, button or image to activate Postcode
Lookup
Then
add
either a link, using the following code to activate the Postcode
Lookup Web pop-up:
Example link to activate Postcode Lookup Window:
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.aspx',420,450)"
>Lookup
Address from link</a>
Example Button to activate Postcode Lookup Window:
<input
type=button value="Lookup Address"
onClick="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.aspx',420,450)">
This
could easily be changed to use a image button.
These
buttons can be place by adding a label to your web page and on
the "Page_Load" assign the button code using:
Me.Label19.Text
= "<input ...>"
Example prime Postcode Lookup Window:
simplypostcode_Address1.aspx?postcode=PE132QL
will prime the search window with a postcode when opened
Step 4 : Map your Address fields
Now
edit the JavaScript at the end of file "simplypostcode_Address2.aspx",
to
write the correct address lines, which result from the
Postcode Lookup. Back to your target web page, address
fields:
Example address field mappings:
<script>
window.parent.document.forms[0].T1.value = Company
window.parent.document.forms[0].T2.value = Line1
window.parent.document.forms[0].T3.value = Line2
window.parent.document.forms[0].T4.value = Line3
window.parent.document.forms[0].T5.value = Town
window.parent.document.forms[0].T6.value = County
window.parent.document.forms[0].T7.value = Postcode
window.parent.document.forms[0].T8.value = Country
window.parent.document.forms[0].T9.value = MultiLineAddress
...
</script>
Where
T1-T9 are the address fields you want to fill in on your web
page, "Quoteme.aspx" in our example.
The
"MultiLineAddress" variable shows how to assign the
address to a "Memo" field. Or in other words, a
field which holds all of the address information, which the user
searched for. This can be removed if not used.
Note
: The field names on your form will not not be the same name
as your would expect. Run up your web page and select
"View >> Source" from the Internet Explorer
window to find the actual name ASP.NET has assigned to the textbox
on the HTML Page.
Example:
Input
Text box called "InpLine1"
may become "ctl00$ContentPlaceHolder1$Wizard2$InpLine1"
in actual page
Step 5 : Specify then Data Key
Open
an account with us. Within seconds you will then
receive a data key, by e-mail, which should be put in "simplypostcode_Address1.aspx.vb"
and "simplypostcode_Address2.aspx.vb" files.
This key will enable your account, for a 30 day
evaluation period.
[Open
your account]
Enter
Postcode "ZZ99" to use test data
Requirements:
-
.Net 2005, but could be
easily edited to work on ASP.NET 2003
-
The code should
be place in the same domain as your web page, else the
Postcode Lookup window will not be able to write data back
to parent page
-
Cookies are required if used for Internal use, as
user the must be identifiable to comply with our End User
Agreement
-
Cookies are NOT required for Web use.
The code will NOT use cookies if you use a Web License data
key
[What is the Web use, Internal use]
Compatibility:
- IE5+: IE 5
and above
- FF1+:
Firefox 1.0+. NS6+ and FF beta are assumed as well.
- Opr7+:
Opera 7 and above.
Optional Customisation
The
Pop-up window can be customised in many ways:

The "simplypostcode_Address1.aspx.vb"
code file has many constants which define the above
areas, which can be easily customised.
The
"SimplyLookupImages" sub-directory, contain the images used to create
the window appearance. You could replace these to
change the complete look of the DHTML Web Pop-up window.
The
Simply Postcode Lookup code has been place in a sub-directory
called "SimplyLookup1". This allows two
different pop-ups to placed in the same directory. Simply
name the second Lookup "SimplyLookup2", and edit code
to call the .aspx file in that directory.
Additional Notes:
The
pop-up window is programmed to appear in the middle of the
browser window, but by altering the loadwindow
function the position can be set
function
loadwindow(url,width,height,xpos,ypos){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("SimplyLookupWindow").style.display=''
document.getElementById("SimplyLookupWindow").style.width=
initialwidth=width+"px"
document.getElementById("SimplyLookupWindow").style.height=
initialheight=height+"px"
document.getElementById("SimplyLookupWindow").style.left=xpos+"px"
document.getElementById("SimplyLookupWindow").style.top=ns6?
window.pageYOffset*1+ypos+"px" :
iecompattest().scrollTop*1+ypos+"px"
document.getElementById("SimplyLookupWindowFrame").src=url
}
}
The simply specify the x,y
co-ordinates in the open call (step 3)
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.php',420,450,100,30)"
>Lookup
Address from link</a>
For more information on how the popup
window works see:
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm
|