日期:2014-05-19  浏览次数:20818 次

高手帮帮忙,谁能帮我用C#写一个关于CheckBoxList的AutoPostBack事件,谢谢了。
高手帮帮忙,谁能帮我用C#写一个关于CheckBoxList的AutoPostBack事件,谢谢了。
不要在 <script> </script> 里面写脚本代码.谢谢.

------解决方案--------------------
<asp:CheckBoxList ID= "CheckBoxList1 " runat= "server " AutoPostBack= "True " OnSelectedIndexChanged= "CheckBoxList1_SelectedIndexChanged ">
<asp:ListItem Value= "aa "> aa </asp:ListItem>
<asp:ListItem Value= "bb "> bb </asp:ListItem>
</asp:CheckBoxList>


protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i < CheckBoxList1.Items.Count; i++ )
if(CheckBoxList1.Items[i].Selected)
Response.Write(CheckBoxList1.SelectedValue);
}