【问题标题】:Rowdatabound equivalent in webdatagrid of infragisticsinfragistics 的 webdatagrid 中的 Rowdatabound 等效项
【发布时间】:2012-09-24 09:16:06
【问题描述】:

我正在寻找我们在 asp.net gridview 中的行数据绑定事件。我想要实现的就是这个。

e.row.rowtype == datacontrolrowtype.datarow

关于 webdata grid 的数据绑定事件,但它不起作用,我该如何实现这一点。 关于如何获取行类型及其事件的建议会有所帮助。

【问题讨论】:

    标签: asp.net gridview infragistics webdatagrid


    【解决方案1】:

    好的,不是 100% 确定实现“这个”是什么意思,但是.. WebDataGrid 提供了 2 个版本的此类事件,因此无论您尝试什么,都可能与这些有关。 据我得到您的代码行,您只对数据行感兴趣,并且据我所知,仅针对数据行触发以下与行相关的事件(根据我的经验,绝对不适用于标题或摘要行):

    • 服务器端The InitializeRow event 在网格绑定到数据源中的记录时引发。您可以在常规控件属性中找到它,或使用<ig:WebDataGrid oninitializerow="WebDataGrid1_InitializeRow"... 在标记的顶层添加它 在处理程序中,您可以访问网格和行,并且始终为每个数据行触发此事件:

          protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
      {
          // Use:
          //e.Row.DataItem
          //e.Row.DataKey
          //e.Row.Index
      }
      
    • 客户端 Row Rendered /-ing 事件,仅在启用客户端绑定/渲染时触发。在一行被渲染到 DOM 之后/之前触发的事件,通过添加 <ClientEvents RowRendered="test" /> 来设置,其中 test 是 JavaScript 中处理函数的名称:

      function test(webDataGrid, evntArgs) {
           //The data object with all attributes
           evntArgs.get_dataItem();
      
           //Reference to the actual TR element
           evntArgs.get_rowElement();
      
           //Returns index of the row inside of its container collection.
           evntArgs.get_index();
      
           //Returns data key of the row. It is always an array of objects even in a case of a single data key field.
           evntArgs.get_dataKey();
       }
      

    我认为你应该能够用这些做你想做的事情。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多