2
我正在從sql數據庫中檢索數據。我想分割記錄並將其綁定到三個不同的網格中。在應用分頁之前,一切正常。我得到數據源不支持服務器端數據分頁。錯誤在asp.net中使用linq的Gridview分頁
代碼:
DataTable StoreDisplayTypeList = storeDisplayBL.GetStoreDisplayDetails();
var specialBook = from myRow in StoreDisplayTypeList.AsEnumerable() where (string)myRow["StoreDisplayType"] == "Special Book" select myRow;
var newRelease = from myRow in StoreDisplayTypeList.AsEnumerable() where (string)myRow["StoreDisplayType"] == "New Release" select myRow;
var Seller = from myRow in StoreDisplayTypeList.AsEnumerable() where (string)myRow["StoreDisplayType"] == "Best Seller" select myRow;
var featuredEdition = from myRow in StoreDisplayTypeList.AsEnumerable() where (string)myRow["StoreDisplayType"] == "Featured Edition" select myRow;
this.gvBestSeller.DataSource = Seller;
this.gvBestSeller.DataBind(); // Error
this.gvNewRelease.DataSource = newRelease;
this.gvNewRelease.DataBind(); // Error
this.gvSpecialBook.DataSource = specialBook;
this.gvSpecialBook.DataBind(); // Error
this.gvFeaturedREdition.DataSource = featuredEdition;
this.gvFeaturedREdition.DataBind(); // Error
你是對的,只是澄清 - VAR是強類型的,由RHS - 在這種情況下.AsEnumerable是返回一個IEnumerable的結果集(這當然心不是具體的)。 – RPM1984 2010-10-05 08:43:06
Good Point,Jezza!謝謝 – 2010-11-26 10:38:03