using System.Data.Objects.SqlClient;
//显示工资年月列表数据
var cx_gzny = from aa in sjklj.工资条
where aa.dwid == cxyh.FirstOrDefault().dwid
group aa by aa.月份
into gg
select new
{
年月显示 = SqlFunctions.StringConvert((double?)gg.FirstOrDefault().年份).Trim() + "年" +
SqlFunctions.StringConvert((double?)gg.Key).Trim() + "月工资条",
年月分割 = SqlFunctions.StringConvert((double?)gg.FirstOrDefault().年份).Trim() + "|" +
SqlFunctions.StringConvert((double?)gg.Key).Trim()
};//已经去重
//aa:每一行,gg每一组
不用SqlFunctions,一些字符串的处理,例如toString(), tri没法应用
this.ASPxRadioButtonList_gzny.DataSource = cx_gzny;
this.ASPxRadioButtonList_gzny.TextField = "年月显示";
this.ASPxRadioButtonList_gzny.ValueField = "年月分割";//根据|分割,得出整型的年份和月份,便于查询
this.ASPxRadioButtonList_gzny.DataBind();