无论我做什么或尝试下拉列表都不仅仅是工作,
<asp:DropDownList ID="drop1" runat="server" AutoPostBack="true" enabledviewstate="true" OnClick="Drop1_SelectedIndexChanged" />
绑定在这里,
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindDropDownList();
}
//drop1.SelectedIndexChanged += new EventHandler(Drop1_SelectedIndexChanged);
}
这是永远不会触发的方法(我使用断点检查)
protected void Drop1_SelectedIndexChanged(object sender, EventArgs e)
{
//checkboxlist1.Items.Add("hahahha");
}
有没有其他选择?????????我需要使用填充下拉列表,
using (SqlDataSource ds = new SqlDataSource(ConnectionString(), SelectCommand()))
{
System.Data.DataView dv = (System.Data.DataView)ds.Select(DataSourceSelectArguments.Empty);
if (dv.Count > 0)
{
drop1.DataSource = ds;
drop1.DataTextField = "UserName";
drop1.DataBind();
drop1.Items.Insert(0, "Please select a Username ");
}
}