Dor*_*Gen 14 asp.net devexpress client-side aspxgridview
我正在尝试在客户端获取选定的网格行KeyField值;
我曾经尝试过以下各种结果:
<ClientSideEvents RowClick="function(s, e) {var key= grid.GetSelectedKeysOnPage()[0];}" />
//This gives previous selected rows value everytime
Run Code Online (Sandbox Code Playgroud)
<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!
Run Code Online (Sandbox Code Playgroud)
<ClientSideEvents RowClick="function(s, e) { grid.GetRowValues(e.visibleIndex, 'MyKeyFieldName', OnGetRowValues); }">
//This gives the same result with Method #2
Run Code Online (Sandbox Code Playgroud)
问题是:如何在没有回调或回发的情况下在客户端RowClick事件中收集当前所选行的KeyField Value(而不是之前但是)?
Mik*_*ail 18
方法#2和#3
这两种方法都需要回调服务器.
确保已指定行选择操作所需的ASPxGridView.KeyFieldName属性.
如何在没有回调或回发的情况下收集所选行@客户端的KeyField值?
处理客户端ASPxClientGridView.SelectionChanged事件;
确定刚通过" e.isSelected "属性选择的行;
通过客户端ASPxClientGridView.GetRowKey方法确定行的keyValue .
将" e.visibleIndex "属性作为参数传递:
<ClientSideEvents SelectionChanged="function(s, e) {
if (e.isSelected) {
var key = s.GetRowKey(e.visibleIndex);
alert('Last Key = ' + key);
}
}" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
58768 次 |
| 最近记录: |