0

我们正在为我们的 Web 应用程序使用 AspXGridView devXgrid。我必须为网格中的一列分配两个值(id,value)。我怎样才能做到这一点?

谢谢,P.Gopalakrishnan。

4

1 回答 1

0

这会打开一罐蠕虫。如果您启用了排序、分组和/或过滤,它们应该如何工作?

有很多方法可以做到这一点,这里有一个(忽略其他问题)......

protected void ASPxGridView1_Init(object sender, EventArgs e) {
    // Creates a column, customizes its settings and appends it to the Columns collection;
    GridViewDataTextColumn colTotal = new GridViewDataTextColumn();
    colTotal.Caption = "IdValue";
    colTotal.FieldName = "IdValue";
    colTotal.UnboundType = DevExpress.Data.UnboundColumnType.String;
    colTotal.VisibleIndex = ASPxGridView1.VisibleColumns.Count;
    ASPxGridView1.Columns.Add(colTotal);
}
// Populates the unbound column.
protected void ASPxGridView1_CustomUnboundColumnData(object sender, ASPxGridViewColumnDataEventArgs e) {
    if (e.Column.FieldName == "IdValue") {
        e.Value = e.GetListSourceFieldValue("Id") + " " +  e.GetListSourceFieldValue("Value");
    }
}

http://devexpress.com/Help/?document=ASPxGridView/CustomDocument3770.htm&levelup=true

于 2009-10-05T14:50:54.037 回答