您的位置:首页 > 移动开发 > Objective-C

custom format Property of business object for the data binding

2011-08-03 00:55 567 查看
This normally used for a generated business object. (nettier)

get the business object.

create a new Property Display Name, which based on property FirstName and Surname:

The first line is important for data Binding. If you bind the property to a gridview, you need this line code. the example code should exist the its base entity class, which generated by nettier.

[DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
public string DisplayName
{
get
{
if (!String.IsNullOrEmpty(FirstName))
{
if (!String.IsNullOrEmpty(Surname))
{
return string.Format("{0} {1}", FirstName, Surname);
}
else
{
return FirstName;
}
}
else
{
if (!String.IsNullOrEmpty(Surname))
{
return Surname;
}
else
{
return "N / A";
}
}
}
}


Then you can find the new property in the datasource window. (Data -> show DataSource).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐