Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在项目选择复选框列表上设置事件_Asp.net - Fatal编程技术网

Asp.net 在项目选择复选框列表上设置事件

Asp.net 在项目选择复选框列表上设置事件,asp.net,Asp.net,如何基于复选框列表(ASP.net 3.5)中的选定项触发事件,复选框列表中的OnSelectedIndexChanged返回所有选定项的列表,其中我只需要知道当前选定项。为什么复选框列表不返回所有选中的复选框?复选框列表的本质是可以同时选择多个复选框 如果您只需要一个项目,也许radioButtonList或DropDownList更合适 请随意测试CheckBoxList.SelectedItem,但其措辞并未明确表示它与RadioButtonList或DropDownList具有相同的功

如何基于复选框列表(ASP.net 3.5)中的选定项触发事件,复选框列表中的OnSelectedIndexChanged返回所有选定项的列表,其中我只需要知道当前选定项。

为什么复选框列表不返回所有选中的复选框?复选框列表的本质是可以同时选择多个复选框

如果您只需要一个项目,也许radioButtonList或DropDownList更合适

请随意测试CheckBoxList.SelectedItem,但其措辞并未明确表示它与RadioButtonList或DropDownList具有相同的功能


两者都继承自System.Web.UI.WebControl.ListControl,并可以共享此功能。复选框列表也可能是ListControl的错误选择。
Protected void DropDownList1_SelectedIndexChanged(object sender,
     System.EventArgs e)
{
   Label1.Text = "You selected " + DropDownList1.SelectedItem.Text;
}