Assuming you have a web control with the following declaration,
...
<%@ Register TagPrefix="dnn"
TagName="Address"
Src="~/Controls/Address.ascx" %>
...
<dnn:Address id="addressControl" runat="server" />
...
you can restrict the countries in the code-behind like so:
using System.Linq;
...
private static readonly string[] Countries
= new[] { "Canada", "Mexico", "United States" };
...
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
var list = this.addressControl.FindControl("cboCountry")
as CountryListBox;
foreach (var item in list.Items.Cast<ListItem>().ToArray())
{
if (!Countries.Contains(item.Text))
list.Items.Remove(item);
}
}
Enjoy!
1 comment:
If you are looking into making cash from your websites/blogs via popunder advertisments - you can try one of the biggest companies: Propeller Ads.
Post a Comment