C# 无法计算未实现ICollection的数据源的计数。

C# 无法计算未实现ICollection的数据源的计数。,c#,repeater,paging,C#,Repeater,Paging,这是我的密码 var q = from a in bh join b in hr on a.HotelCode equals b.hotelCode select new { a.HotelCode, a.ImageURL_Text, a.HotelName, a.StarRating,

这是我的密码

 var q = from a in bh
                join b in hr on a.HotelCode equals b.hotelCode
                select new
        {
            a.HotelCode,
            a.ImageURL_Text,
            a.HotelName,
            a.StarRating,    
            a.HotelAddress,
            a.Destination,
            a.Country,
            a.HotelInfo,
            a.Latitude,
            a.Longitude,
            b.totalPrice,
            b.totalPriceSpecified,
            b.totalSalePrice,
            b.totalSalePriceSpecified,
            b.rooms

    };

        //rptHotels.DataSource = getres.availableHotels;

        PagedDataSource objPds = new PagedDataSource();
        objPds.DataSource = q;
        objPds.AllowPaging = true;
        objPds.PageSize = 10;// Convert.ToInt32(ddlPageNo.SelectedValue);

        objPds.CurrentPageIndex = CurrentPage;

        lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
           + objPds.PageCount.ToString();

        // Disable Prev or Next buttons if necessary
        cmdPrev.Enabled = !objPds.IsFirstPage;
        cmdNext.Enabled = !objPds.IsLastPage;

        rptHotels.DataSource = objPds;
        rptHotels.DataBind();
错误有自我解释,但没有找到解决此错误的方法……

使用ToArray()

使用ToArray():


在“选择新”之前添加“按a.hotelName,a.StarRating排序”在“选择新”之前添加“按a.hotelName,a.StarRating排序”在“选择新”之前添加“按a.hotelName,a.StarRating排序”在“按a.hotelName,a.StarRating排序”之前添加“按a.hotelName,a.StarRating排序”的排序
objPds.DataSource = q.ToArray();