checkbox status lost after update panel works

烈酒焚心 提交于 2019-12-25 03:03:07

问题


I have an update panel, which fires every third seconds. I have this code into my asp.net page

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

and I add its content dynamically like this:

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

My problem

when the page loads, the checkboxes are like this:

Then, I change the values to these:

but when the update pannel works, the page returns to its default statues, where nothing of the checkboxes are selected

could you help please?

来源:https://stackoverflow.com/questions/23848540/checkbox-status-lost-after-update-panel-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!