复选框选中的索引更改函数即使在选中后也不会被调用
本文关键字:调用 索引 复选框 函数 | 更新日期: 2023-09-27 18:25:06
选择项目时,不会触发更改事件。
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");
}
}
你试过把AutoPostBack="true"
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true"
DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>