ASPX templates
Version 5.x > ASPX templates > Country Selector View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
adam-syndicut - 9/8/2010 4:57:31 AM
   
Country Selector
I want to use the country selector but on selectiing usa it displays state selector.

what do i need to change to stop it displaying the state?


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/10/2010 1:11:26 AM
   
RE:Country Selector
Hi,

One option is to delete the states associated with USA in Site Manager -> Development -> Countries -> USA -> States tab.

Another option is to modify the country selector form control and change its code to never show the states selector (\CMSFormControls\CountrySelector.ascx.cs).

Best regards,
Juraj Ondrus

User avatar
Member
Member
charize.ojeda-edenred - 9/22/2010 2:15:48 AM
   
RE:Country Selector
kentico_jurajo wrote: Hi,

One option is to delete the states associated with USA in Site Manager -> Development -> Countries -> USA -> States tab.

Another option is to modify the country selector form control and change its code to never show the states selector (\CMSFormControls\CountrySelector.ascx.cs).

Best regards,
Juraj Ondrus


Hello,
How do I set the default value of drop down menu to "Please select country" index 0, if im getting data from CMS_Country. I need this for the registration page.

Thank you

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/23/2010 2:59:01 AM
   
RE:Country Selector
Hi,

you can modify the table CMS_Country and add the row with CountryID=0 into it. You can use following commands:

SET IDENTITY_INSERT [CMS_Country] ON

INSERT INTO [CMS_Country]
([CountryID],[CountryDisplayName],[CountryName],[CountryGUID],[CountryLastModified])
VALUES
(0,'Select country','SelectCountry','bdf3154e-7c19-4fe2-9a7f-ba36529fc7bd','2008-03-13 09:35:00.000')

SET IDENTITY_INSERT [CMS_Country] OFF


The value Select country will be the selected and the first one in the dropdown menu.

Better solution is to create your own form control. You can set the default value according to your needs and then you can check if this value was not selected and force users to select the correct country.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
sdonthineni-allianceglobalservices - 7/25/2012 6:00:39 AM
   
RE:Country Selector
Will the validations fire in this case if so how will they fire

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/26/2012 3:38:54 AM
   
RE:Country Selector
Hello,


do you mean when you develop a new form control or when you simply add a new record to the CMS_Country table?

If you create a new form control, you can specify the rules for IsValid condition. Please see here: Developing form controls.

The validation fires automatically and it must meet the condition in the IsValid method to pass the validation.

If you add a new record, it uses the same validation as for other values of Country selector.


Best regards,
Helena Grulichova