Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 选中复选框即使在选中后也不会调用“索引已更改”函数_C#_Asp.net - Fatal编程技术网

C# 选中复选框即使在选中后也不会调用“索引已更改”函数

C# 选中复选框即使在选中后也不会调用“索引已更改”函数,c#,asp.net,C#,Asp.net,选择项目时,不会触发更改事件 ASP页面: <asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"> </asp:CheckBoxList>

选择项目时,不会触发更改事件

ASP页面:

<asp:CheckBoxList ID="CheckBoxList1" runat="server" 
    DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name"
    OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"> 
</asp:CheckBoxList>

你试过把AutoPostBack=“true”


   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");
    }

}
<asp:CheckBoxList ID="CheckBoxList1" runat="server"  AutoPostBack="true" 
    DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name"
    OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"> 
</asp:CheckBoxList>