2012-03-12 130 views
0

我在ASP.net中有一个复选框列表,其中有几个选项。有没有办法让我的身体检查箱看不见?我希望它只有有问题的物品是可见的,但箱子是不可见的。如果这是不可能的,有人会推荐一个替代的ASP控件,其行为类似于checkboxlist?使复选框列表不可见

比如我有一个CheckBoxList的像这样:

<asp:CheckBoxList ID="Example" runat="server" AutoPostBack="false" RepeatColumns="2" RepeatDirection="Horizontal">   
     <asp:ListItem> 1 </asp:ListItem> 
     <asp:ListItem> 2 </asp:ListItem> 
     <asp:ListItem> 3 </asp:ListItem> 
     <asp:ListItem> 4 </asp:ListItem> 
     <asp:ListItem> 5 </asp:ListItem> 
</asp:CheckBoxList> 

现在我只想数量是可见且可选,但我想复选框是无形的。就像一个按钮的工作方式,但我觉得创建x个按钮可能会更乏味。

按答案我已经尝试了演示jQuery和本出来了:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Testjq.Test" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<script type = "text/javascript" src ="Scripts/jquery-1.7.1.min.js"></script> 
<script type = "text/javascript" src ="Scripts/jquery-ui-1.8.18.custom.min.js"></script> 
<script> 
    $(function() { 
     $("#check").button(); 
     $("#format").buttonset(); 
    }); 
    </script> 
    <style> 
    #format { margin-top: 2em; } 
    </style> 
    <title></title> 
</head> 
<body> 



<div class="demo"> 

<input type="checkbox" id="check" /><label for="check">Toggle</label> 

<div id="format"> 
    <input type="checkbox" id="check1" /><label for="check1">B</label> 
    <input type="checkbox" id="check2" /><label for="check2">I</label> 
    <input type="checkbox" id="check3" /><label for="check3">U</label> 
</div> 

</div><!-- End demo --> 

</body> 
</html> 

Unfortunatley我仍然无法得到它的工作。任何额外的帮助将不胜感激。

回答

1

你检查了jQueryUI吗?

看看演示页:http://jqueryui.com/demos/button/#checkbox

如果我深知他们有你在寻找什么。

+0

这正是我在找的东西,但是你能否提供一个例子将它应用到checkboxlist?如果我将.button应用于复选框列表,它只会让输入列表成为一个按钮。 – 2012-03-12 16:53:32