选择项目时,不会触发更改事件。
ASP页面:
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>
CS代码:(选择项目后不调用此功能)
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Chart1.Visible = false;
}
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
Chart1.Visible = true;
CDLDataAccess.dao.Insert("inside");
}
}
答案 0 :(得分:1)
你有没有试过.. AutoPostBack =“true”
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true"
DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>