第一种:

List<ItemType> LsItemType = DBFactory.CreateDA().List<ItemType>();

        if (LsItemType.Count > 0)
        {
            foreach (ItemType TypeItem in LsItemType)
            {
                DropDownListItemType.Items.Add(TypeItem.Name);
            }
        }

 

第二种:

 

List<ItemType> LsItemType = DBFactory.CreateDA().List<ItemType>();

        DropDownListItemType.DataSource = LsItemType;
        DropDownListItemType.DataTextField = "Name";
        DropDownListItemType.DataValueField = "Name";
        DropDownListItemType.DataBind();

相关文章:

猜你喜欢
相关资源
相似解决方案