小弟在页面中用到了这个CheckBoxList控件,但是在给它用Attributes添加客户端的onclick属性时却怎么了不起用作,下面是我的代码:
SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnStr"]);
myConnection.Open();
SqlCommand myCommand=new SqlCommand("select * from d_orderstate order by sequence asc",myConnection);
SqlDataReader mydr=myCommand.ExecuteReader();
order.DataSource=mydr;
order.DataTextField="name";
order.DataValueField="name";
order.DataBind();
for(int i=0;i<order.Items.Count;i++)
{
order.Items[i].Attributes.Add("name","order");
order.Items[i].Attributes.Add("onclick","unselect('OrderAll','order')");
order.Items[i].Selected=true;
}
其它数据都好的,就是添加属性不起作用,在查看源文件时根本就没有onclick这个属性,请各位大哥救 救 我