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