C# - Dumping a list to a dropdownlist

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

List is populated here, then sorted:



        
6条回答
  •  鱼传尺愫
    2020-12-15 22:47

    Why not just bind the DDL directly to the List like

    DropDownList ddl = new DropDownList();
    ddl.DataSource = nameList;
    ddl.DataBind();
    

提交回复
热议问题