我开始使用asp.net编程,我有一个带有一些复选框的表。
问题是,我无法创建静态表,因为此操作与某些参数相关联。无论如何..当我点击First复选框时,我想要反转此表中的其他复选框。 我怎么能抓住这个事件?
artboardWidth = 640
Framer.Device.contentScale = (Screen.width / artboardWidth)
var substringMatcher = function (strs) {
return function findMatches(q, cb) { // an array that will be populated with substring matches
var matches = [];
// regex used to determine if a string contains the substring `q`
//var substrRegex = new RegExp(q, 'i');
// we use starts with instead of substring
var substrRegex = new RegExp('^' + q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function (i, str) {
if (substrRegex.test(str)) {
matches.push(str);
}
});
cb(matches);
};
};
答案 0 :(得分:1)
你可以试试这段代码
List<CheckBox> lstChckBox;
protected void Page_Load(object sender, EventArgs e)
{
// you can create controls programaticaly or html page, doesnt important
//only you should know controls ID and all controls share same checked event
CheckBox chc1 = new CheckBox();
chc1.CheckedChanged += new EventHandler(chck_CheckedChanged);
CheckBox chc2 = new CheckBox();
chc2.CheckedChanged += new EventHandler(chck_CheckedChanged);
CheckBox chc3 = new CheckBox();
chc3.CheckedChanged += new EventHandler(chck_CheckedChanged);
// Now, you can create a List so event is fired, you can catch which controls checked or not
lstChckBox = new List<CheckBox>();
lstChckBox.Add(chc1);
lstChckBox.Add(chc2);
lstChckBox.Add(chc3);
}
void chck_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkBox = (sender as CheckBox);
foreach (CheckBox item in lstChckBox)
{
if (item != checkBox)
{
item.CheckedChanged -= new EventHandler(chck_CheckedChanged);
item.Checked = !checkBox.Checked;
item.CheckedChanged += new EventHandler(chck_CheckedChanged);
}
}
}