asp.net CheckBoxList minimum width CSS style of compatibility good

  • 2020-06-03 06:12:52
  • OfStack

ASP. NET, CheckBoxList choice is automatic width, didn't set the width attribute set.
Referring to the minimum width style of 1 network,
 
/*  Minimum �  */ 
.min_width{min-width:300px; 
/* sets max-width for IE */ 
_width:expression(document.body.clientWidth < 300 ? "300px" : "auto"); 
} 

It is written as follows:
 
<style> 
.ckblstEffect td 
{ 
min-width:80px; 
_width:expression(document.body.clientWidth < 80 ? "80px" : "auto"); 
} 
</style> 

 
<asp:CheckBoxList ID="ckblstEffect" runat="server" DataTextField="MC" 
RepeatDirection="Horizontal" RepeatColumns="10" CssClass="ckblstEffect" 
DataValueField="ID" ondatabound="ckblstEffect_DataBound"> 
</asp:CheckBoxList> 

This doesn't work in Maxthon 4 compatibility mode (IE7), but if you look closely at the expressions in the styles, it doesn't work at all.
Just change to the following style.
 
<style> 
.ckblstEffect td 
{ 
min-width:80px; 
width:expression(this.offsetWidth < 80 ? "80px" : "auto"); 
} 
</style> 

Minimum width displays correctly in IE10, Max speed 4 and compatible modes. This style can be used for CheckBoxList, DIV, etc.

Please let me know if you find that other browsers cannot display the CheckBoxList minimum width.

Related articles: