【发布时间】:2012-01-15 03:07:15
【问题描述】:
我正在尝试在客户端获取选定的网格行 KeyField 值;
我曾经尝试以下并得到各种结果:
方法#1
<ClientSideEvents RowClick="function(s, e) {var key= grid.GetSelectedKeysOnPage()[0];}" />
//This gives previous selected rows value everytime
方法#2
<ClientSideEvents RowClick="function(s, e) { grid.GetRowValues(grid.GetFocusedRowIndex(), 'MyKeyFieldName', OnGetRowValues); }" />
//This gives previous selected row and also gives an error: "A primary key field specified via the KeyFieldName property is not found in the underlying data source. Make sure.. blabla" But the MyKeyFieldName is true and i dont want to make a callback, i dont want to use this method!
方法#3
<ClientSideEvents RowClick="function(s, e) { grid.GetRowValues(e.visibleIndex, 'MyKeyFieldName', OnGetRowValues); }">
//This gives the same result with Method #2
问题是:如何在没有回调或回发的情况下在客户端 RowClick 事件中收集(不是先前但)当前选定行的 KeyField 值?
【问题讨论】:
标签: asp.net devexpress client-side aspxgridview