标签:
前台代码:
<td>账户名称:</td>
<td>
<asp:DropDownList ID="DropDownListAccount" runat="server" Width="80px"></asp:DropDownList>
</td>
后端初始化代码:
private void InitDropDownListAccount()
{
DropDownListAccount.Items.Clear();
List<Account> accountInfo = accountManager.GetAccountInfoList();
ListItem item = new ListItem("---全部---", "");
item.Selected = true;
DropDownListAccount.Items.Add(item);
foreach (Account account in accountInfo)
{
item = new ListItem(account.AccountName, account.AccountID.ToString());
DropDownListAccount.Items.Add(item);
}
}
后台 AccountID 获取代码:
string DropDownListAccount= DropDownListAccount.SelectedValue;
标签:
原文地址:http://www.cnblogs.com/hanxingli/p/5228186.html