【问题标题】:Finding records in RadGrid Telerik with pagination使用分页在 RadGrid Telerik 中查找记录
【发布时间】:2011-12-27 15:20:05
【问题描述】:

启用分页后,如何在 radGrid 中按键查找给定记录?插入元素后,我想选择新行,这就是我需要此功能的原因。

感谢您的帮助

【问题讨论】:

    标签: asp.net telerik


    【解决方案1】:

    一种方法是禁用分页,然后创建Rebind,然后遍历所有项目,找到项目应该所在的页面,然后启用分页。另一种方法是为每页单独设置Rebind,如下所示:

    int count = RadGrid1.MasterTableView.PageCount;  
    for (int i = 0; i < count; i++) 
    { 
        RadGrid1.CurrentPageIndex = i; 
        RadGrid1.Rebind();
    
        foreach (GridDataItem dataItem in RadGrid1.Items) 
        { 
            var yourID = dataItem.GetDataKeyValue("YourID"); 
            if (yourID == insertedItemID)
               break;
        }  
    }     
    RadGrid1.Rebind(); 
    

    有关更多信息和示例,请查看 Telerik 论坛。这个链接很有用:

    【讨论】:

      【解决方案2】:

      这是来自 Telerik 的链接,它将选择 Last Updated 或 Last Inserted 行。

      Select last Updated or Inserted row in Telerik RadGrid

      【讨论】:

        【解决方案3】:
        RadGrid1.AllowPaging = false;
        RadGrid1.Rebind();
        
        foreach (GridDataItem dataItem in RadGrid1.Items) 
        { 
            var yourID = dataItem.GetDataKeyValue("YourID"); 
            if (yourID == insertedItemID)
               break;
        }  
        

        RadGrid1.AllowPaging = true; RadGrid1.Rebind();

        【讨论】:

          猜你喜欢
          • 2011-12-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-05-15
          • 2011-04-02
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多