Login
Downloads
  TitleLast UpdatedSizeDownload
Add additional regions -DNN3 7/13/2005 93.00 Download
Additional regions 9/3/2004 52.00 Download
Extend regions SQL 9/3/2004 0.00 Download
SQL for UK regions 9/3/2004 10.00 Download
Announcements
SQL for UK regions  - 22-Apr-2004
There is no ISO standard for UK regions(or counties if you like) follow the link below for some background on the problems with UK regions ISO. http://www.idude.net/I18N/articles/web_forms_and_iso_3166.asp For UK counties based on the BS 6879 standard visit the link below @ page 13 http://www.eanguatemala.org.gt/comercioexterior/maritimo/cuscar/unlocode_paises.pdf  
Update for v2.0.3 - 30-Mar-2004
The code required for DNN 2.03 has been added to the bottom of the notes. Many thanks to Francois Rioux.  
Add additional regions to the registration page - 2-Oct-2003
Out of the box Dotnetnuke only supports listbox regional data for the US and Canada, with all other country options using a simple textbox. To enable additional regions requires a small change to the code (which requires a recompilation) and the addition of data to one of the database tables. In addition to this, to facilitate a forum request, there is a script to alter the CodeRegion table, so that the region code can be 3 digits, rather than 2. Please feel free to use the 'Country & Region Details' contact box to the left to email me your country and region details. I will add them to downloadable sql script, and ensure that the core DNN team get them for possible inclusion in a future version of Dotnetnuke. Please note: These changes are tested on 1.0.10c but I expect them to work on most other versions.  
New entries to addional_regions.sql file - 15-Oct-2003
Australia,Brazil,China,Germany,India,Malaysia,New Zealand,South Africa kindly supplied by Manning (voxhumana)
Poland and Netherlands kindly supplied by Geert
16/10/03 - Afghanistan,Andorra,Antigua and Barbuda,Bangladesh,Barbados,Chile,Colombia,Costa Rica,Cuba,Czech Republic,Denmark,Greece,Hong Kong,Hungary,Indonesia,Israel,Mexico,Pakistan,Peru,Portugal,Saudi Arabia,South Korea,Suriname,Taiwan,Thailand,United Arab Emirates,Venezuela,Viet Nam,Yugoslavia added  

Instructions
NOTE: These changes are unnecessary in DNN 3, as it handles the country region relationships as part of the localization efforts

To enable 3 character region codes, please download the 'extend region code' script. This is a SQL script that will create a temporary table similar to the existing CodeRegion table, but with an expanded Code field. Next it will copy across any existing data from the original table, then delete it, before finally renaming the temporary table and reapplying it's primary key. The script  runs as a transaction and locks the table during the data copy to ensure validity.


To run SQL scripts, use enterprise manager/sql query analyzer if you have them, otherwise log in as the host user and run the script under the Host->SQL menu.


Now we add the addition data by downloading the additional regions sql script (or else by creating your own). To create your own simply look in the CodeCountry table for the correct code e.g. Australia is AU. Now generate a series of INSERT statements, one for each region code and name combination e.g


INSERT INTO [dbo].[CodeRegion] ([Code], [Description], [Country]) VALUES ('NSW', 'New South Wales', 'AU')


Once you have your script, simply run it as before. Please note, the script is cumulative, and will initially clear out all entries that do not belong to the US or CA Country code.


Finally we need to make some code changes. Locate and open the address.ascx.vb file in the controls folder. Find the Localize() subroutine. The standard DNN code has two hardcoded lookups (one for US and one for Canada). Rather than hardcode our lookups,or have to make SQL changes as well as code changes, I've opted to examine the SqlDataReader returned by the GetRegionCodes stored procedure. If it has 1 or more row's returned, but has passed the hardcoded checks for US and CA, then it's one of our additional regions, so we display it in a listbox, otherwise default to the textbox. This has the advantage of being a one time simple change, but does mean that we are doing a region lookup twice (once as a count, and once to use the data), and that the word 'region' is hardcoded.


Original Code


 Case Else
                        cboRegion.ClearSelection()
                        cboRegion.Visible = False
                        txtRegion.Visible = True
                        valRegion1.Enabled = False
                        valRegion2.Enabled = True
                        lblRegion.Text = "Region:"
                        lblPostal.Text = "Postal Code:"
End If


New Code


 Case Else
                    If objAdmin.GetRegionCodes(cboCountry.SelectedItem.Value).HasRows Then
                        cboRegion.ClearSelection()
                        cboRegion.Visible = True
                        txtRegion.Visible = False
                        cboRegion.DataSource = objAdmin.GetRegionCodes(cboCountry.SelectedItem.Value)
                        cboRegion.DataBind()
                        cboRegion.Items.Insert(0, New ListItem("", ""))
                        valRegion1.Enabled = True
                        valRegion2.Enabled = False
                        lblRegion.Text = "Region:"
                        lblPostal.Text = "Postal Code:"
                    Else
                        cboRegion.ClearSelection()
                        cboRegion.Visible = False
                        txtRegion.Visible = True
                        valRegion1.Enabled = False
                        valRegion2.Enabled = True
                        lblRegion.Text = "Region:"
                        lblPostal.Text = "Postal Code:"
                    End If


Finally, compile dotnetnuke (Build menu in visual studio or mk.bat for others), and copy the new dotnetnuke.dll to your site.







DNN 2.03 version, kindly supplied by Francois Rioux.

Case Else
Dim aRegion as System.Collections.ArrayList = objRegionalController.GetRegionsByCountry(cboCountry.SelectedItem.Value)
If aRegion.Count>0 Then
cboRegion.ClearSelection()
cboRegion.Visible = True
txtRegion.Visible = False
cboRegion.DataSource = aRegion cboRegion.DataBind()
cboRegion.Items.Insert(0, New ListItem("", ""))
valRegion1.Enabled = True
valRegion2.Enabled = False
lblRegion.Text = "Region:"
 lblPostal.Text = "Postal Code:"
Else
 cboRegion.ClearSelection()
cboRegion.Visible = False
txtRegion.Visible = True
valRegion1.Enabled = False
valRegion2.Enabled = True
lblRegion.Text = "Region:"
lblPostal.Text = "Postal Code:"
end if