DorpDownList資料DataBind的撰寫方式

DorpDownList資料DataBind的撰寫方式

小喵剛開始使用DropDownList
心想應該可以將DataSet的資料DataBind上去
可是執行結果卻顯示了一串的【system.Data.DataRowView】

後來發現,原來是少指定了【DataTextField】,所以.NET不知道要把哪個欄位放到Text

正確的方式應該如下


slt1.DataTextField="欄位名稱1"
slt1.DataBind()

 


以下是簽名:


Microsoft MVP
Visual Studio and Development Technologies
(2005~2019/6) 
topcat
Blog:http://www.dotblogs.com.tw/topcat