Telerik asp.net ajax 网格分页不起作用

Telerik asp.net ajax grid pagination not working

我做了一个简单的购物车模块系统

当我点击第 2 页时,没有显示任何内容,只是我上传到这里的空白页面

namespace PaymentGateWay
{
    public partial class Payments : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 if (!IsPostBack)
            {

                readcoupons();
               // dt = new DataTable();
               // DataTable dtn = new DataTable();

               // dt.Columns.Add("chkstatus");
               // dt = dtn;ViewState["dt"]
                ViewState["dt"] = "NULL";

            }

 }

   private void readcoupons()
        {

            BAL.READDATA readcoupons = new READDATA();
            DataSet ds = readcoupons.ReadCoupons();
            rg_coupons.DataSource = ds.Tables[0];
            rg_coupons.DataBind();



        }

您必须在其 NeedDataSource 事件中向 RadGrid 提供数据源,而不是仅在初始页面加载时。

服务器代码:

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    BAL.READDATA readcoupons = new READDATA();
    DataSet ds = readcoupons.ReadCoupons();
    rg_coupons.DataSource = ds.Tables[0];
}

标记:

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"></telerik:RadGrid>`enter code here`