2015-09-07 81 views
1

我做了一個簡單的購物車模塊系統Telerik的asp.net阿賈克斯電網分頁不工作

enter image description here

當我點擊沒有2沒有什麼是顯示剛好在我在這裏上傳

一個空白頁的頁

enter image description here

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(); 



     } 
+0

我認爲你必須調用'readcoupons()'再次pagingIndexChanged'方法 – TFrost

+0

pagingindexchanged後'都來調用...我新到asp.net – coolboy

+0

在aspx設計器中選擇你的'telerik-grid'並轉到它的屬性..你可能會發現'pagingIndexChanged'。我還沒有使用'telerik-grid',但我相信它將包含用於此目的的方法。 – TFrost

回答

1

您必須在其NeedDataSource事件提供數據源radgrid控件,而不是INIT僅限頁面加載。

服務器代碼:

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` 
+0

非常感謝你:) – coolboy

+1

不客氣。我還編輯了您的帖子標題,以使其與具有此類問題的其他人的實際內容和問題相關。 – rdmptn