DropDownList 控制項的-AppendDataBoundItems 屬性

  • 1967
  • 0

DropDownList 控制項的-AppendDataBoundItems 屬性

STEP1. 加入DropDownList 控制項

請加入一個DropDownList 控制項,並在其Items 中加入一個「==請選擇==」項目。

暫存檔02

STEP2. 加入SqlDataSource 資料來源控制項

STEP3. 設定AppendDataBoundItems 屬性

暫存檔03

執行結果:不用程式碼即可完成。

暫存檔01

出處參考:聖殿祭司的 ASP.NET 2.0 專家技術手冊