Lucian Rusu
Lucian Rusu

Reputation: 1

The data source does not support server-side data paging. .toList() is not working

I'm trying to load some data from a database, and to filter them using this method. Now, i want also to show them by pages, especially at the non-filtered part.

I used a DataAdaptor to fill up a dataset table, on which I'm making my filtering.

protected void Page_Load(object sender, EventArgs e)
{

    if (!IsPostBack)
    {
        string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
        OracleConnection con = new OracleConnection(CS);
        string query = "select * from table1";
        OracleDataAdapter dataAdapter = new OracleDataAdapter(query, con);

        DataSet dataSet = new DataSet();
        dataAdapter.Fill(dataSet, "mytbl");
        Session["DATASET"] = dataSet;

        GridView1.DataSource = from dataRow in dataSet.Tables["mytbl"].AsEnumerable()
                               orderby dataRow["ID"]
                               select new guards
                               {
                                   ID = Convert.ToInt32(dataRow["ID"]),
                                   Nume = dataRow["NUME"].ToString()
                               };
        GridView1.AllowPaging = true;
        GridView1.DataBind();
    }

Upvotes: 0

Views: 148

Answers (1)

AIDA
AIDA

Reputation: 529

You will have to tell ASP.NET how to page. in this case it is .Skip().Take()

Upvotes: 1

Related Questions