Tôi có CheckBoxList này trên một trang:Giá trị DataValueField cho một CheckBoxList được lưu trữ ở đâu?
<asp:checkboxlist runat="server" id="Locations" datasourceid="LocationsDatasource"
datatextfield="CountryName" datavaluefield="CountryCode" />
Tôi muốn lặp qua các yếu tố ô trống trên máy khách sử dụng Javascript và lấy giá trị của mỗi hộp kiểm tra, nhưng các giá trị dường như không được có sẵn ở phía khách hàng. Sản lượng HTML trông như thế này:
<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>
Các giá trị ("cd", "cg", "ga", vv) là hư không để được tìm thấy. Họ ở đâu? Thậm chí có thể truy cập chúng trên máy khách hay tôi có cần tự xây dựng danh sách hộp kiểm này bằng bộ lặp hay cái gì đó không?
Cảm ơn. Tôi đoán tôi sẽ chỉ cần xây dựng danh sách kiểm tra với một bộ lặp. –