- - PR -
ADO.NET Tips & Tricks #2 - DropDownList
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2002-04-11 21:23
DropDownListの先頭に(All)を表示させるには
DropDownListの先頭アイテムに(All)を表示させるには、Unionクエリーを使用すると便利です。 たとえば、得意先マスタのDropDownListの先頭に(All)を表示させるには、次のようなSQLを使用します。 SQL Command: Select CustomerID, CompanyName From Customers Union Select 0 As CustomerID, '(All)' As CompanyName From Customers Order by CustomerID Tips & Tricks #2 DEMO Happy Programming! |
|
投稿日時: 2002-05-13 10:25
この DEMO では、UNION クエリを使用して DropDownList の先頭に
(All)を表示しています。 DropDownListの Insert メソッドを使用するとUNION クエリを使用しないで テキストを任意の位置に表示させることができます。 objDropDownList.Items.Insert(position, item) 例: objDropDownList.Items.Insert(0, New ListItem("(All)")) objDropDownList.Items.Insert(0, New ListItem("-- Please Choose --")) |
1