假如我给CheckBoxList的每一项添加一个onclick属性,是OK的 for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
{
this.CheckBoxList1.Items[i].Attributes.Add("onclick", "alert('test);");
}最终生成的HTML为:<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" onclick="alert('test);" />------------------------------------------------------------------------------------------------
但我现在想为每一项添加一个onpropertychange属性,我尝试 for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
{
this.CheckBoxList1.Items[i].Attributes.Add("onpropertychange", "alert('test);");
}最终生成的HTML为:<span onpropertychange="alert('test);">
<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" />
</span>-----------------------------------------------------------------------------------------------
我现在想生成的HTML为<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" onpropertychange="alert('test);"/>该如何做?
{
this.CheckBoxList1.Items[i].Attributes.Add("onclick", "alert('test);");
}最终生成的HTML为:<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" onclick="alert('test);" />------------------------------------------------------------------------------------------------
但我现在想为每一项添加一个onpropertychange属性,我尝试 for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
{
this.CheckBoxList1.Items[i].Attributes.Add("onpropertychange", "alert('test);");
}最终生成的HTML为:<span onpropertychange="alert('test);">
<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" />
</span>-----------------------------------------------------------------------------------------------
我现在想生成的HTML为<input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" onpropertychange="alert('test);"/>该如何做?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货