在本週之前,我從來沒有在我的生活中寫過一縷ASP.NET,所以請在我身上輕鬆一下。檢查ASP Repeater控件中的空數據庫值
我有一個ASP.NET頁面顯示來自數據庫的圖片。我創建一個SqlDataReader並將轉發器綁定到這個閱讀器。該頁面顯示一個包含三列的表格:pic的縮略圖(來自數據庫的路徑),照片的拍攝名稱(來自數據庫)以及有關照片的註釋。
當我上載圖片到數據庫時,評論將爲空。我希望表格顯示註釋(如果存在),或者註釋字段在數據庫中爲空,則顯示ASP文本框和按鈕以供用戶輸入關於圖片的註釋。
事實證明這並不像我想象的那麼容易。任何人都可以建議我:
A)的明確的測試以確定是否該行的「註釋」一欄爲空
B)如何有條件地顯示任何文本或文本框/按鈕組合(有texbox來自數據庫的「ID」列的ID)
我相信我有技巧來編寫按鈕點擊處理程序來更新數據庫與評論...如果我能得到它顯示。
非常感謝,並承諾未來會拒絕ASP.NET項目!