更新面板工作后复选框状态丢失

时间:2014-05-24 18:49:53

标签: c# jquery html asp.net updatepanel

我有一个更新面板,每三秒触发一次。我将此代码放入我的asp.net页面

<div ID="campaignDiv" runat="server" >
                            <ul>
                            </ul>
                        </div>

我会动态添加其内容:

 private string CreateLiCheckbox(string checkBoxText)
        {
            return string.Format("<li><span class=\"textDropdown\">{0}</span><input id=\"{1}\" value=\"{0}\" type=\"checkbox\"><label for=\"{1}\"></label></li>", checkBoxText, checkBoxText + "dropdownID");
        }
if (!IsPostBack) {
                List<string> comps = getCompainNames();
                string html = "<ul>";
                for (int i = 0; i < comps.Count(); i++) {
                    html = html + CreateLiCheckbox(comps[i]);
                }
                html = html + "</ul>";
                campaignDiv.InnerHtml = html;
            }

我的问题

页面加载时,复选框如下: econd

然后,我将值更改为:

enter image description here

但是当更新面板工作时,页面将返回其默认状态,其中未选中任何复选框

你可以帮忙吗?

0 个答案:

没有答案
相关问题