我的 ASP.Net 应用程序中有一个 RadGrid,我已将 AllowPaging 设置为 True 并将 PageSize 设置为 10,现在它为每个 RadGridPage 加载 10 个项目,这是我想要的,但只要我按下下一页按钮(箭头查看按钮)什么都没有加载,RadGrid 变空。我怎样才能让它正常工作?
protected void Page_Load(object sender, EventArgs e)
{
PopulateGridOnLoad();
}
private void PopulateGridOnLoad()
{
rgCustomers.DataSource = odsCustomers;
// your datasource type
rgCustomers.MasterTableView.VirtualItemCount = 28;
//your datasource type total/count
rgCustomers.CurrentPageIndex = rgCustomers.MasterTableView.CurrentPageIndex;
rgCustomers.Rebind();
}
protected void grdName_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
rgCustomers.DataSource = odsCustomers;
// your datasource type
rgCustomers.MasterTableView.VirtualItemCount = 28;
//your datasource type total/count
rgCustomers.CurrentPageIndex = rgCustomers.MasterTableView.CurrentPageIndex;
//Donot rebind here
}
protected void btnLoad_Click(object sender, EventArgs e)
{
odsCustomers.SelectParameters["CustomerFullName"].DefaultValue = txtFullName.Text;
odsCustomers.SelectParameters["CustomerMelliCode"].DefaultValue = txtMelliCode.Text;
odsCustomers.SelectParameters["CustomerHomeAddress"].DefaultValue = txtHomeAddressPart.Text;
odsCustomers.SelectParameters["CustomerWorkAddress"].DefaultValue = txtWorkAddressPart.Text;
rgCustomers.DataSource = odsCustomers;
rgCustomers.DataBind();
}