I have a class which retrieves the data from DB.
[Table(Name = "Ilanlar")]
public class Ilan
{
[Column(Name="ilan_id" ,IsPrimaryKey = true)]
public int M_ilan_id;
[Column(Name="refVerenUser_id")]
public int M_refVerenUser_id;
}
And i am binding the data comes from db via the class above.
private void ItemsGet()
{
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = f_IlanlariGetir(CurrentPage);
objPds.AllowPaging = true;
objPds.PageSize = 3;
objPds.CurrentPageIndex = CurrentPage;
rptIlanlar.DataSource = objPds; //rptIlanlar = asp:Repeater
rptIlanlar.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
ItemsGet();
}
private System.Collections.IEnumerable f_IlanlariGetir(int p)
{
Context context = new Context(DAO.dbYaban.ConnectionString);
return context.GetTable<Ilan>();
}
But the result is IEnumerable but i need something like DataSet. I'm getting this error:
I found good explanation about this error, it is:
The underlying DataSource has to support the ICollection interface in order for the grid to perform automatic paging. ICollection requires a class to implement a Count property. ArrayList and DataView both support the interface, so you could use them as DataSources.Other classes only support the IEnumerable interface. This allows them to be used as a DataSource but not as a paged data source. SqlDataReader would be an example of such a class. Reference
But i need to bind repeater with the results of linq to sql tables. What should i do?