Esempio n. 1
0
        protected void btnShowAll_Click(object sender, EventArgs e)
        {
            txtTitle.Text            = "";
            dropStatus.SelectedIndex = 0;
            dropStatus.SelectedIndex = 0;
            DataTable dt = NewsBll.getAllNews();

            if (dt.Rows.Count > 0)
            {
                AspNetPager1.RecordCount = dt.Rows.Count;
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource       = dt.DefaultView;
                pds.PageSize         = AspNetPager1.PageSize;
                pds.AllowPaging      = true;
                pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
                dgNews.DataSource    = pds;
                dgNews.DataBind();
            }
            else
            {
                dgNews.DataSource = null;
                dgNews.DataBind();
            }
        }