C# - Dumping a list to a dropdownlist

前端 未结 6 1617
耶瑟儿~
耶瑟儿~ 2020-12-15 22:09
List nameList = new List();
DropDownList ddl = new DropDownList();

List is populated here, then sorted:



        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 22:26

    Replace this:

     ddl.Items.Add(new ListItem(nameList[name].ToString()));
    

    with this:

     ddl.Items.Add(new ListItem(name));
    

    Done like dinner.

提交回复
热议问题