Atlas 學習之001:“ToggleButtonExtender”

來源:互聯網
上載者:User

 原文地址:http://blogs.vertigosoftware.com/alanl/archive/2006/07/27/3156.aspx

源碼下載:http://blogs.vertigosoftware.com/files/alan/atlastogglebutton.zip

譯文概要:

    使用“Atlas Control Toolkit”中的“ToggleButtonExtender”,你可以建立非常酷的“checkboxes”:“ ToggleButtonExtender”使用圖片 來“裝扮”ASP.NET 的“Checkbox”控制項 !

 

詳細步驟:

1、開啟“Visual Studio 2005”,“建立網站”、在“我的模板”中選擇“"Atlas" Web Site”、至於“位置”和“語言”,你可以隨意選了,確定。

 

2、雙擊“Default.aspx”開啟它,把下面的代碼貼在“<form id="form1" runat="server">”的下面:

<atlas:ScriptManager ID="ScriptManager1" runat="server" />
        <div class="togglebutton">
            <asp:CheckBox ID="CheckBox1" runat="server" Text="Default ASP.NET Checkbox" /><br /><br />
            <asp:CheckBox ID="CheckBox2" runat="server" Text="Improved Checkbox with the ToggleButtonExtender" /><br />
            <asp:CheckBox ID="CheckBox3" runat="server" Checked="true" Text="Can extend multiple checkboxes" /><br />
            <asp:CheckBox ID="CheckBox4" runat="server" Text="Any icon can be used" />
        </div>
        <atlastoolkit:ToggleButtonExtender ID="ToggleButtonExtender1" runat="server">
            <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox2" CheckedImageUrl="images/checked.png"
                UncheckedImageUrl="images/unchecked.png" ImageHeight="16" ImageWidth="16" />
            <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox3" CheckedImageUrl="images/checked.png"
                UncheckedImageUrl="images/unchecked.png" ImageHeight="16" ImageWidth="16" />
            <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox4" CheckedImageUrl="images/ToggleButton_Checked.gif"
                UncheckedImageUrl="images/ToggleButton_Unchecked.gif" ImageHeight="19" ImageWidth="19" />
        </atlastoolkit:ToggleButtonExtender>

 

3、選擇“方案總管”,建立“image”檔案夾,然後把以下4個圖片檔案貼在“image”檔案夾裡,注意每個檔案的名字不要搞錯了!
:checked.png
:unchecked.png
:ToggleButton_Checked.gif
:ToggleButton_Unchecked.gif

4、選擇“方案總管”,右擊“Bin”檔案夾,把“AtlasControlToolkit.dll”、“Microsoft.AtlasControlExtender.dll”兩個檔案引用進來,這兩個檔案的位置大約如下:
“D:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/atlastogglebutton/70397d33/_shadow/70e01143/bin/1”,實在找不到,搜尋一下!

 

5、儲存網站所有檔案,右擊“ToggleButton.aspx”檔案,選擇“在瀏覽器中查看”,最後的效果應該出來了,比較酷喲!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.