0

我有一个 devexpress 网格

dxwgv:GridViewDataCheckColumn Caption="ONE" FieldName="ONE">

我的所有列都带有复选框 + 行选择上有复选框,例如 checbox | 列(复选框) | 列(复选框) | 列(复选框) | 列(复选框)

问题是在选中/取消选中任何列复选框时获取行值。我尝试使用 Eval 并添加到复选框的 ClientInstanceName 但将 clientInstanceName 作为参数从 javascrit 发送是问题(我使用“chkbox_id.ClientInstanceName”但没有用)

任何帮助将不胜感激。谢谢

4

1 回答 1

0

在网格上设置客户端实例名称:

ClientInstanceName="YourGrid"

然后在页面上的某个位置添加一个控件,以允许用户“全选”,如下所示:

<input id="chkSelectAll" type="checkbox" onclick="YourGrid.SelectAllRowsOnPage(this.checked);" />

最后在后面的代码中你可以做这样的事情:

// aColumnName is the name of the column from which you want the value.
private List<object> GetSelectedRowValues(string aColumnName) 
    {
        List<object> values = new List<object>();
        string[] valueToGet = { aColumnName };

        for (int i = 0; i < YourGrid.VisibleRowCount; i++)
        {
            if (YourGrid.Selection.IsRowSelected(i))
            {
                //get the passed in value for the selected rows.
                values.Add(YourGrid.GetRowValues(i, valueToGet));
            }
        }

        return values;
    }
于 2010-02-17T16:53:37.173 回答