asp.net – 存储CheckBoxList的DataValueField值在哪里?
发布时间:2020-12-16 00:07:01 所属栏目:asp.Net 来源:网络整理
导读:我在页面上有这个CheckBoxList: asp:checkboxlist runat="server" id="Locations" datasourceid="LocationsDatasource" datatextfield="CountryName" datavaluefield="CountryCode" / 我想使用Javascript遍历客户端上的复选框元素并获取每个选中复选框的值,
我在页面上有这个CheckBoxList:
<asp:checkboxlist runat="server" id="Locations" datasourceid="LocationsDatasource" datatextfield="CountryName" datavaluefield="CountryCode" /> 我想使用Javascript遍历客户端上的复选框元素并获取每个选中复选框的值,但这些值似乎在客户端不可用. HTML输出如下所示: <table id="ctl00_Content_Locations" class="SearchFilterCheckboxlist" cellspacing="0" cellpadding="0" border="0" style="width:235px;border-collapse:collapse;"> <tr> <td><input id="ctl00_Content_Locations_0" type="checkbox" name="ctl00$Content$Locations$0" /><label for="ctl00_Content_Locations_0">Democratic Republic of the Congo</label></td> </tr><tr> <td><input id="ctl00_Content_Locations_1" type="checkbox" name="ctl00$Content$Locations$1" /><label for="ctl00_Content_Locations_1">Central African Republic</label></td> </tr><tr> <td><input id="ctl00_Content_Locations_2" type="checkbox" name="ctl00$Content$Locations$2" /><label for="ctl00_Content_Locations_2">Congo</label></td> </tr><tr> <td><input id="ctl00_Content_Locations_3" type="checkbox" name="ctl00$Content$Locations$3" /><label for="ctl00_Content_Locations_3">Cameroon</label></td> </tr><tr> <td><input id="ctl00_Content_Locations_4" type="checkbox" name="ctl00$Content$Locations$4" /><label for="ctl00_Content_Locations_4">Gabon</label></td> </tr><tr> <td><input id="ctl00_Content_Locations_5" type="checkbox" name="ctl00$Content$Locations$5" /><label for="ctl00_Content_Locations_5">Equatorial Guinea</label></td> </tr> 无法找到值(“cd”,“cg”,“ga”等).他们在哪?甚至可以在客户端访问它们,还是我需要使用转发器或其他东西自己构建这个复选框? 解决方法
存储在ViewState中,如果没有
some hacking,则无法在客户端上访问它们.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如何在KeyUp上进行文本框回发?
- asp.net-mvc-3 – NHibernate.ObjectNotFoundException:不
- asp.net-mvc – 如何将应用程序用户放在与其余对象相同的上
- ASP.NET:以编程方式更改网站的文化
- asp.net-mvc – MVC授权 – 多个登录页面
- 需要有关ASP.NET本地化的建议 – 存储在数据库中并显示在gr
- asp.net-mvc – 如何使用状态代码返回客户端错误消息
- asp.net-mvc – 加载符号时Visual Studio调试痛苦地慢
- asp.net-mvc – 使用Ajax.Beginform的RedirectToAction,意外
- asp.net-mvc – 如何将特定于HTTP-Request的对象注入到我提