سؤال

i have a user control that i place it on Default.aspx. in Default.aspx i have this code:

   ds = FillFromDatabase();
        Session["note"] = ds.Tables[0];

and in usercontorl i have this code:

 if (Session["note"] != null)
        {
            ListView1.DataSource = Session["note"] as DataTable;
            ListView1.DataBind();

        }

listview has a datapager with 5 page. when i click on next page it not wroking when i again click on next it works correctly. any idea?

هل كانت مفيدة؟

المحلول

i found the solution:

protected void ListView1_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
    {
        DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
        DbAccessor db1 = new DbAccessor();
       ListView1.DataSource = fillFromDb();

        ListView1.DataBind();
    }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top