AspxGridview包含所有复选框列

问题描述 投票:0回答:1

我有一个devexpress网格

dxwgv:GridViewDataCheckColumn Caption =“ONE”FieldName =“ONE”>

我有所有列的复选框+行上有复选框选择a.g.复选框|列(复选框)|列(复选框)|列(复选框)|柱(复选框)

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

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

aspxgridview
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;
    }
© www.soinside.com 2019 - 2024. All rights reserved.