I have a CheckBoxList which displays data on a selectedIndexChange action of a DropDownList. Everything works correctly. I have checked it in a button click event. But When I use it with a selectedIndexChange nothing happens. I dont get any error or exception. I have enabled AutoPostBack property too.
Here is my code
<asp:CheckBoxList ID="chklstKPI" style="width:auto; height:auto; float:right" runat="server" AutoPostBack="True">
</asp:CheckBoxList>
code of the CheckBoxList
public void loadCheckBoxPanel()
{
DataSet ds = new DataSet();
string cName = ddlCompName.SelectedValue.ToString();
ds = db.fillCheck(cName);
chklstKPI.DataSource = ds.Tables[0];
chklstKPI.DataTextField = "COMPETITION_KPI";
chklstKPI.DataValueField = "COMPETITION_KPI";
chklstKPI.DataBind();
}
I didn't add the query.
答案 0 :(得分:0)
bool isLoading = true;
private void Form1_Load(object sender, EventArgs e)
{
chklstKPI.Style.Visibility="hidden";
chklstKPI.Style.Displpay="none";
myList.OnSelectedIndexChanged += performCheckBoxAction;
myList.SelectedIndex=0;
isLoading = false;
}
protected void performCheckBoxAction(object sender, EventArgs e){
if(isLoading==false){
isLoading = true;
chklstKPI.Style.visibility="visible";
chklistKPI.Style.display="show";
isLoading=false;
}
}