This is a migrated thread and some comments may be shown as answers.

[Solved] Bind complex type to column

0 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roland
Top achievements
Rank 1
Roland asked on 05 Feb 2011, 08:48 AM
Hi,

I'm using AJAX databinding and I have the following model class:

public class SampleModel {
    [DisplayFormat(NullDisplayText = "(null value)")]
    public ChildModel ChildModel { get; set; }
}

Now I want to do this:
 .Columns(columns =>
       
{
            columns
.Bound(m => m.ChildMOdel)


That's why I decorated the ChildModel class like this:
[DisplayColumn("FullName")]
public class ChildModel {
    [Required, StringLength(25)]
    public string FirstName { get; set; }
 
    [Required, StringLength(25)]
    public string LastName { get; set; }
 
    [ScaffoldColumn(false)]
    public string FullName {
        get {
            return FirstName + " " + LastName;
        }
    }
}
But the grid seems to output the raw serialized data for the object in the column. Is DisplayColumnAttribute not supported? If not, how do I do this? Thanks.

Tags
Grid
Asked by
Roland
Top achievements
Rank 1
Share this question
or