我在我的ASP.NET項目中有一個自定義的數據訪問層。它進入數據庫並檢索所有需要的數據並將其作爲DataTable對象返回。 我要綁定的數據表到DevExpress的ComboBox控件之一:分配DataTable到SqlDataSource
var productsDal = DalProviderFactory.Instance.GetProductsDal();
cbProducts.DataSource = productsDal.GetAllProductNames(); //--> One-column DataTable object is returned here.
cbProducts.DataMember = "ProductName"; //--> Specifying name of the column.
cbProducts.DataBind();
這不工作;它肯定結合的東西,但不能正確顯示:
確定。我發現ComboBox實際上接受SqlDataSource對象作爲它的DataSource。所以I'ce試圖配置之一:
<asp:SqlDataSource ID="dsProducts" runat="server" />
現在,而不是將其連接到數據庫本身,我想用我的DAL並以某種方式分配給數據表在SqlDataSource。有沒有辦法做到這一點?
在此先感謝。
類沒有DisplayMember屬性我一直想知道爲什麼DevExpress的開發人員改變標準名稱的東西完全誤導:(這是像WinForms控件一樣(一個特別的東西讓我瘋狂 - 當你需要使用Hidden而不是Visible進行視覺控制時),現在我在WebForms中看到了完全相同的東西:( 無論如何非常感謝!Spasibo!: ) –