Devexpress ASPxGridView GetSelectedFieldValues Can't get values

天涯浪子 提交于 2019-12-04 11:15:34

I think this is not the correct way to get the values from the grid at client side, check the following link: http://www.devexpress.com/Support/Center/p/Q94237.aspx

[JScript]
function Button1_onclick() {
    ASPxGridView1.GetSelectedFieldValues("CategoryID;CategoryName", OnGetSelectedFieldValues);
}

function OnGetSelectedFieldValues(result) {
    for(var i = 0; i < result.length; i ++)
        for(var j = 0; j <result[i].length; j++) {
            alert(result[i][j]);
        }
} 

Question: is your grid support multiple selection?

Edit1: Check the following Examples as well:

How to use a GetSelectedFieldValues method to obtain values of several columns at once

How to get the values of the selected record from the server

ASPxClientGridView.GetSelectedFieldValues method send a callback to get the specified data. So, if you don't bind the ASPxGridView at the server side on this callback (and you actually don't - because of condition [ if (!IsCallback) ]) grid cannot return the data.

BTW, this works on the currect page because ASPxGridView is caching the data for the current page (see EnableRowsCache property definition).

You may want to try turning off callbacks for the grid. I've found that this solves some issues that I run into with the grid. I am not sure this will work, but it may be worth a shot.

<dxwgv:ASPxGridView ID="xgvMyGrid" runat="server" AutoGenerateColumns="False"
 EnableCallBacks="False">

Note...Although the grid should still work just fine, this may affect other code you may already have in place.

And also please check the KeyFieldName of Grid. If this information is not specified or not correct you may also not be able to retrieve the values in GetSelectedFieldValues client event.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!