DNN get Province (US or Canada) or Get Country List

void BindProvice()
    {
        ListController list = new ListController();
        ListEntryInfoCollection lic = list.GetListEntryInfoCollection("Region", "Country.CA");
       
        ddlProvince.DataSource = lic;
        ddlProvince.DataTextField = "Text";
        ddlProvince.DataValueField = "Text";
        ddlProvince.DataBind();

    }

  

lic 是ListEntryInfo集合, ListEntryInfo包含常用的属性有:

Text,

Value,

DisplayName,

ListName.

等等

 

 

Get Country:

void BindCountry()
    {
        ListController list = new ListController();
        //ListEntryInfoCollection lic = list.GetListEntryInfoCollection("Country");
        ListEntryInfo lic = list.GetListEntryInfo("Country", "CA");
        ddlCountry.DataSource = new List<ListEntryInfo>(){lic};
        ddlCountry.DataTextField = "Text";
        ddlCountry.DataValueField = "Text";
        ddlCountry.DataBind();
    }

  

我这里只要获取CA,所以注释掉了:

ListEntryInfoCollection lic = list.GetListEntryInfoCollection("Country");

posted @ 2011-11-13 16:13  无尽思绪  阅读(427)  评论(0编辑  收藏  举报