2012-03-12 81 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