asp.net如何保存复选框萨特斯当更新面板的作品? [英] asp.net how to save checkbox satus when the update panel works?

查看:93
本文介绍了asp.net如何保存复选框萨特斯当更新面板的作品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个更新面板女巫定时器工作,每30秒。

该页面包含很多复选框。当更新面板的作品,复选框返回到其默认状态,虽然他们中的一些人更新面板的作品之前选择。

任何帮助吗?
还有的checkboxs:

 < D​​IV ID =campaignDiv=服务器>
                            < UL>
                                <立GT;
                                    <跨度类=textDropdown>文本1< / SPAN>
                                    <输入类型=复选框ID =1值=1/>
                                    <标签=1>< /标签>
                                < /李>
                                 <立GT;
                                     <跨度类=textDropdown>文本1< / SPAN>
                                    <输入类型=复选框ID =2值=2/>
                                    <标签=2>< /标签>
                                < /李>
                                 <立GT;
                                     <跨度类=textDropdown>文本1< / SPAN>
                                    <输入类型=复选框ID =3值=3/>
                                    <标签=3>< /标签>
                                < /李>
                                 <立GT;
                                     <跨度类=textDropdown>文本1< / SPAN>
                                    <输入类型=复选框ID =4值=4/>
                                    <标签=4>< /标签>
                                < /李>
                            < / UL>
                        < / DIV>


解决方案

添加属性 =服务器您的复选框。这会让他们的服务器端控件,并允许使用ASP.NET的ViewState保存其状态。

请注意,您可能需要更改复选框的标识(和标签有关)目前是你喜欢的数字1,你必须让他们如字母C1。

I have an update panel witch works in timer every 30 seconds.

the page contains many checkbox. when the update panel works, the check boxes return to their default statuses though some of them were selected before the update panel works.

any help please? There are the checkboxs:

<div ID="campaignDiv" runat="server" >
                            <ul>
                                <li>
                                    <span class="textDropdown">Text1</span>
                                    <input type="checkbox" id="1" value="1"/>
                                    <label for="1"></label>
                                </li>
                                 <li>
                                     <span class="textDropdown">Text1</span>
                                    <input type="checkbox" id="2" value="2"/>
                                    <label for="2"></label>
                                </li>
                                 <li>
                                     <span class="textDropdown">Text1</span>
                                    <input type="checkbox" id="3" value="3"/>
                                    <label for="3"></label>
                                </li>
                                 <li>
                                     <span class="textDropdown">Text1</span>
                                    <input type="checkbox" id="4" value="4"/>
                                    <label for="4"></label>
                                </li>
                            </ul>
                        </div>

解决方案

Add attribute runat="server" to your checkboxes. This will make them server-side controls and allow to use ASP.NET ViewState to save their states.

Note that you may have to change IDs of the checkboxes (and related for labels) currently yours are numeric like "1", you will have to make them alphanumeric e.g. "C1".

这篇关于asp.net如何保存复选框萨特斯当更新面板的作品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆