クライアント側で選択したグリッド行のKeyField値を取得しようとしています。ASPXGridView ClientSideEvents選択した行の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
質問:
私は以下のことを試してみて、さまざまな結果を得るために使用されますです:どのように私はgathすることができますEr KeyFieldコールバックまたはポストバックなしでクライアントのRowClickイベントで現在選択されている行の値(前回ではなく)
ありがとうございますが、これは私が期待してい答えではありません。私はどのようにClientside RowClickイベントで新たに選択した行のKeyfield値を集めることができますか?そして、ASPxClientGridView.GetSelectedKeysOnPage [0]は、選択が変更されたときに変更されます。 – DortGen
私の解決策を試しましたか?それは何の結果ですか? – Mikhail
あなたはMikhailのソリューションを使用したい場合、 SelectionChangedイベントの使用に関する問題:ユーザーがソートまたはフィルターをかけたとき。格納されたキーは更新されません(SelectionChangedイベントはトリガされません) – kite