这是一个商城网站,在商品的内容页面,选择衣服的尺寸。
我这里使用的是
                 <div class="">
                                <asp:Label ID="Label2" runat="server" Text="尺寸"></asp:Label>
                                <asp:RadioButtonList ID="RadioButtonList2" runat="server" RepeatDirection="Horizontal"
                                    RepeatColumns="8" CssClass="yanseyangshi1" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList_SelectedIndexChanged">
                                </asp:RadioButtonList>
                                <asp:HiddenField ID="chicuncun" runat="server" />
                            </div>
后台使用        protected void RadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
        {
            RadioButtonList rbl = sender as RadioButtonList;
            foreach (ListItem li in rbl.Items)
            {
                if (li.Selected == true)
                {
                    li.Attributes.Add("style", "background-color: red;");
                }
            }
        }在谷歌浏览器,选中项,样式变为红色,在IE浏览器无发触发RadioButtonList_SelectedIndexChanged事件。

解决方案 »

  1.   

    http://blog.imbolo.com/css-hack-in-ie6-ie7-and-firefox/
    http://csscreator.com/node/26325
      

  2.   

    RadioButtonList的autopostback设置为true,然后写SelectedIndexChanged事件代码 
      

  3.   

    无法触发事件指的是debug的时候不能进入方法?
    单纯看这点代码没有什么问题
      

  4.   

    这种功能建议还是用jquery等去实现更好 不要什么都往后台放 
    多用HTML控件 少用服务器控件 !!
      

  5.   

    RadioButtonList的按钮样式被修改了,之前的input的display设置成了none
    我后来把input的display:none;删了,才好。
    不过这样样式就变了。
    有什么好方法?