不管我做什么,或者尝试下拉列表不只是工作,替代ASP.NET下拉列表
<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 ");
}
}