想必winform 裡的comboBox令經常使用下拉式清單的朋友很爽,既簡易功能又多,不僅可以通過下拉框顯示資料項目,還可以像textBox一樣輸入,最絢的功能可能就是自動匹配功能了吧。然而在webform裡,只有一個dropdownlist,是可以顯示下拉資料項目,但是要想再自己輸入些內容估計就懸了,更別說根據輸入內容自動匹配資料項目了。在google裡搜了一下,好些朋友都是通過一個textBox加上一個listbox,在自己寫點Js通過層控制來模仿comboBox,功能實現了,目的卻到達的不是很好,弄不好還會錯位。作為初學者可以試著去寫一下多學習學習,本人比較懶,所以總是喜歡用別人開發好的控制項。終於回到正題,今天給朋友們介紹的是MetaBuilders,簡單幾步就可以得到自己想要的comboBox.下面簡單給大家說一下步驟希望能給從沒用過別人控制項的朋友一點點協助,也藉此機會把自己的隨筆放在首頁上一次,第一次放首頁,如果有覺得不妥的朋友請給出意見,我馬上撤回老家。
步驟如下:
1.下載MetaBuilders控制項(包括Bll檔案,資料檔案,使用說明等)http://www.codeplex.com/metabuildersweb,解壓檔案;
2.開啟您的vs(我的是2005,不知道別的版本是否有問題,本人估計其他版本也沒問題),開啟工具列,在空白處右擊選擇“添加選項卡”(個人建議建立一個新的)命名為“MetaBuilder”,在該選項下,右擊選擇“選擇項”(稍等時間可能有點長),在快顯視窗的下方單擊“瀏覽”,選擇剛才下載的檔案中的MetaBuilders.WebControls.dll檔案。
3.選擇工具列裡的comboBox,拖到你想要的位置,ok了,就像vs內建的控制項一樣了,剩下的工作就看你自己了。
該控制群組中還有好些不錯的控制項,等著更多的朋友去發現其中的奧妙,下面列出其中包含的更多控制項名和簡要說明:(拷自官方首頁)
- AdSense Ads - Controls to show your Google AdSense ads.
- CheckedListBox - A Listbox with checkboxes for selection
- ComboBox - The classic type-or-choose control.
- DataControlFields - Three fields for the GridView, BooleanField for boolean values (better than the CheckBoxField), LookupField for ID/Key data to a child datasource, and SelectorField for row selection using checkboxes or radiobuttons.
- DialogWindow - A set of controls which make creating dialog windows a lot easier
- DualList - move items back and forth between two listboxes to select the items
- DynamicListBox - a base control which stores changes to its list of items
- ExpandingButtons - hide and show a target control
- ExpandingPanel - hide and show the content of the panel
- FileUpload - A nicer wrapper than the builtin for basic file uploading
- GlobalRadioButton - A radiobutton which has a page-wide, cross-namingcontainer Group property
- Grouped Lists aka GroupedListBox and GroupedDropDownList enabled support of the html option grouping in extensions of the standard data controls.
- ListLink - A non-visual control which helps you create parent/child relationships between list controls
- MultiFileUpload is a nice compact UI that lets the user select more than one file to upload to the server.
- MultiViewBar is now free and included in the library, source and all.
- OneClick - non-visual control that helps the page developer avoid the dreaded double-button-click
- Polling - controls and framework for showing users simple web polls. Uses a provider framework, with built-in providers for Access and Sql Server.
- ParsingContainer - control which parses a string of server control markup at runtime
- QueryCall - Component which maps querystring parameters to methods in the codebehind
- RemoteWindow - Easy popup windows
- ResizeMonitor - causes a postback on browser-resize, if you need to keep track of dimensions in your app
- RollOverLink - the old mouse-over-out effect on images, made dead-easy
- RuntimeTemplate - Makes it easier to create templates for controls at runtime in code
- UpDown - the classic Windows Up/Down control for numeric entry.
補充一句,使用說明是英文的,英文好的朋友可以一顯身手了。