checkbox status not saved when update panel fires

前端 未结 2 1975
南方客
南方客 2021-01-25 01:15

I have an div id = campaignDiv and I load its content dynamically

The content is checkboxes .

I have an update panel that fires every 30 seconds.

2条回答
  •  萌比男神i
    2021-01-25 01:54

    To have more space for code here is my suggestion for the checkboxlist again. I hope it's that what you are asking for.

    .aspx

    
        
            

    .aspx.cs

    if (!IsPostBack)
    {
        var comps = new[] { "default", "sales", "direct" };
        for (int i = 0; i < comps.Count(); i++)
        {
             myCheckboxList.Items.Add(new ListItem{Text = comps[i]});
        }
    }
    

    This way it will keep your checkbox checked

提交回复
热议问题