How to have two values ​​for a column in a grid

We are using AspXGridView devXgrid for our web application. I need to assign two values ​​(id, value) to a column in a grid. How can i do this?

Thank P.Gopalakrishnan.

0


a source to share


1 answer


This opens the can of worms. If you have sorting, grouping and / or filtering, how are they supposed to work?

There are several ways to do this, here's one (ignoring other issues) ...



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

0


a source







All Articles