开发者

CheckboxList input Not working in IE7/6

开发者 https://www.devze.com 2022-12-19 07:50 出处:网络
I modified asp.net checkboxlist using css. It hides input using display:none and I\'m able to click on label and casue postback in Firefox but in IE when i click label in checkbox list it doesn\'t wor

I modified asp.net checkboxlist using css. It hides input using display:none and I'm able to click on label and casue postback in Firefox but in IE when i click label in checkbox list it doesn't work. What could be wrong here?

My code:

<div style="padding-left:15px;">
 <asp:CheckBoxList ID="cbl" runat="server" AutoPostBack="true"
      RepeatLayout="flow" CssClass="cb"   
      OnSelectedIndexChanged="cblD_OnSelecte开发者_如何学运维dIndexChange">                                
</asp:CheckBoxList>

css:

.cb input
{
  display:none;   
}

.cb label
{
  font-size:80%;
  background: #fff url(../images/x.gif) no-repeat;  
  display:block;
  width: 300px;
  height: 15px;
  padding: 1px 5px 0 30px;
}


Invisible elements dont trigger events in IE. A better method would be to use javascript to cause the postback instead of using hidden elements. If you really want to get creative you could whip out the ajax :) (just dont use .NET ajax...)


Quick and Not best fix: i changed my css so that input will have margin -150px, this way i don't have to hide input and achieve what i wanted

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号