I can't bind the Devexpress XtraGrid column to my property!
I am using a Strongly Typed Data Set for my application and I needed a custom property that doesn't exist in my database table, so I created it as follows:
Code:
public partial class MyDataSet{
partial class UsersRow
{
public string RoleName
{
get
{
return ((RealEstateDS.RolesRow)this.GetParentRows("FK_Users_Roles")[0]).Name;
}
}
}
}
Then I set the FieldName property of XtraGrid to RoleName, but it doesn't work with it. The XtraGrid only shows the properties that have column in the DataTable. Do you know how can I solve this开发者_StackOverflow中文版 problem?
I would suggest that you use the XtraGrid's unbound column instead. BTW, does the standard DataGridView shows this column value?
Maybe some more code gives more insight because this should be easily possible. I shouldn't go for an unbound column. It's much more overhead. Is it an editable grid / column. I think you need a setter as well then. Else this property can't be set through databinding and this might be the reason that values aren't shown. The column "refuses" the binding. You can explicitly set editing options for every individual columns. Hope it helps.
精彩评论