【发布时间】:2013-05-03 20:48:41
【问题描述】:
无论我做什么或尝试下拉列表都不起作用,
<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 ");
}
}
【问题讨论】:
标签: c# javascript sharepoint webforms controls