views:

90

answers:

2

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_OnSelectedIndexChange">                                
</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;
}
A: 

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...)

Ariel
His labels are not invisible.
Pointy
yes they r not invisible but when you do view source you do not see them in source ( I was suprised)
rs
A: 

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

rs