日期:2014-05-18  浏览次数:20481 次

怎么为CheckBoxList里面的每个CheckBox添加客户端事件onclick
怎么为CheckBoxList里面的每个CheckBox添加客户端事件onclick

------解决方案--------------------
asp.net 2.0可以直接遍历Item添加,以前的版本添加不了,请换用 <input type=checkbox
------解决方案--------------------
类似于这样的属性添加
this.fuSignature.Attributes.Add( "onpropertychange ", imgSignature.ClientID + ".src= 'file:/// ' " + "+this.value ");
------解决方案--------------------
foreach(ListItem item in this.cblCity.Items)
{
item.Attributes[ "onclick "] = "check(this) ";
}

------解决方案--------------------
foreach(ListItem item in this.cblCity.Items)
{
item.Attributes[ "onclick "] = "check(this) ";
}
这样不行。
在这个item.Attributes只有get,没有set所以设置无效。
怎么可能。你试过再说吧。
------解决方案--------------------
item.Attributes.Add( "onclick ", "check(this) ");