Mah*_*ari 5 c# asp.net telerik radgrid
我的 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();
}
Run Code Online (Sandbox Code Playgroud)
经过很长时间我找到了解决方案,问题涉及两个小问题:
1.我同时设置了DataSource(代码中)和DataSourceID(属性),但它们不能很好地协同工作
2.我将AllowPaging和AllowCustomPaging都设置为是的,当它们都为真时,两者都不起作用:)那是你知道的 Telerik 团队,但他们很棒,我是在开玩笑
| 归档时间: |
|
| 查看次数: |
21505 次 |
| 最近记录: |