2012-05-25 56 views
1

我認爲這很容易,但我無法找到如何去做。我發現如何與一個複選框(http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.appearance.aspx)如何修改複選框列表的外觀,看起來像按鈕

做,但,怎麼可能與CheckBoxList控件辦呢?

+1

你可以使用jQuery嗎?如果這是真的,你可以用更復雜的UI包裝DOM –

+0

謝謝你的回答。我發現我可以將樣式更改爲ToggleButton(http://www.asp.net/ajaxlibrary/HOW%20TO%20Use%20the%20ToggleButton%20Control.ashx),我想它會起作用。 但我要求一個更簡單的方法。如果存在允許做或類似的屬性。 – chelder

回答

1

正如史蒂夫乙建議,一個很好的辦法就是使用jQuery。我把一個複選框內ASP:Repeater控件,我修改此複選框看起來像一個按鈕的外觀這是代碼:

<asp:Repeater ID="RepeaterVocabularyWords" runat="server" OnItemCommand="RepeaterVocabularyWords_ItemCommand"> 
    <ItemTemplate> 
     <span class="storeCheck"> 
      <asp:CheckBox ID="CheckBoxVocabularyWord" Font-Size="0px" runat="server" Text="<%# Container.DataItem %>" 
       ClientIDMode="Static" CssClass="{labelOn: '<%# Container.DataItem %>', labelOff: '<%# Container.DataItem %>', easing: 'easeOutBounce', duration: 500}" /> 
     </span> 
    </ItemTemplate> 
</asp:Repeater> 

而且在後面的代碼:

String [] wordsForButtons = new[] { "text1", "text2", "text3" };    
RepeaterVocabularyWords.DataSource = wordsForButtons; 
RepeaterVocabularyWords.DataBind(); 

我希望對某人有用!

Carlos

相關問題