日期:2014-05-17  浏览次数:20422 次

RadioButtonList的RadioButtonList1_SelectedIndexChanged事件为什么激活不了呢?
前台:<div class="goodscr-norm"><p>已经选择:<strong class="fr" id="spec_lebl"><asp:Label ID="LabColor" runat="server"
  Text="Label"></asp:Label></strong></p>
 
<p>
  <asp:RadioButtonList ID="RadioButtonList1" runat="server" 
  onselectedindexchanged="RadioButtonList1_SelectedIndexChanged" 
  RepeatColumns="3" RepeatDirection="Horizontal">
  </asp:RadioButtonList>
  </p>
后台数据绑定: this.RadioButtonList1.DataSource = new NewWanYuan.BLL.ProductColor().GetProductColor(pid);
  this.RadioButtonList1.DataTextField = "Colorname";
  this.RadioButtonList1.DataValueField = "PCID";
  this.RadioButtonList1.DataBind(); 
都没有问题,就是事件:  
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
  {
  if (RadioButtonList1.SelectedIndex != -1)
  {
  this.LabColor.Text = RadioButtonList1.SelectedValue.ToString();
  }
  else
  { this.LabColor.Text = null; }
  }
写了这个事件,单击RadioButtonList1的选项没有反应

------解决方案--------------------
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" onselectedindexchanged="RadioButtonList1_SelectedIndexChanged"
RepeatColumns="3" RepeatDirection="Horizontal">
</asp:RadioButtonList>