DropdownList控制复选框,基本上我的意思是
我有一堆表示名称设置的复选框。所有复选框都显示在页面上。
我创建了一个带有名称的DDL,如果我从DDL中选择一个名称,我可以让DDL检查分配给该名称的任何设置。
或者它不是DDL的内置功能。任何想法
`var r = document.getElementById("Search$AllNamesDDL").innerHTML;
var User = e.option[e.selectedIndex].value;
console.log('User:' + User);
var rs = r.split('</option>');
document.getElementById("Search$AllNamesDDL").innerHTML;
for (var i =0; i<=rs ,i++)
{
If (rs[i])
{
var cleanme = rs[i].replace('<option value="', "");
var sub0 = cleanme.split('">');
console.log("sub0 for (" + i + ") =>" + sub0[1]);
if (sub0[1])
{
var startWith = sub0[1].substring(0, 1);
console.log('The letter you asked for was found for this object');
document.getElementById("Search$AllDevicesDDL").innerHTML += '<option id="' + sub0[1] + '" value="' + sub0[1] + '">' + sub0[1] + '</option>';
}//ifstarWith=alpha
}//for the if(rs[i]
}//for the for condirtional
strSelected='';
var e=document.getElementById("Search_settingSelectCheckBox");
var strSelected=e.options[e.SelectedIndex].value;
$('Search_settingSelectCheckBox').change(function() {
var selected = $('Search_settingSelectCheckBox option:selected');
if (selected.val() == "Select A Device") {
$('input[input=".markerSettingSelectCheckBoxList"]').prop('checked', false);
}
else {
$('input[input=".markerSettingSelectCheckBoxList"]').prop('checked', true);
}
})`
}//for the whole function
)`
这是asp代码: `
EnableViewState="true" >
<asp:ListItem Text="-Select-" Value="Select" Enabled="true"/>
</asp:DropDownList>
<asp:SqlDataSource ID="AllNamesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"
SelectCommand="SELECT * FROM [Names]">
<input type="button" value="Select All" class="markerSelectAll"/>
<input type="button" value="Unselect All" class="markerUnSelectAll"/>
<asp:ObjectDataSource runat="server" ID="SettingsObjectDataSource" SelectMethod="GetDistinctNamesSettingNames"
TypeName="class"></asp:ObjectDataSource>`