i have these 2 classes:
class empidpaytypesettings { public guid oid { get; set; } public guid paytypeoid { get; set; } public int grouptypeid { get; set; } public guid empoid { get; set; } public int orderby { get; set; } } class docreghour { public guid oid { get; set; } public guid documentoid { get; set; } public guid medarbejderoid { get; set; } public guid paytypeoid { get; set; } public string paytypeinfo { get; set; } public double hours { get; set; } public string comment { get; set; } public datetime createddate { get; set; } public datetime lastchangeddate { get; set; } }
i have collection of docreghour
bound datagrids itemsource. want them grouped grouptypeid
, can see 2 classes have paytypeoid
in common.
i tried making non-bound collapsed column header = "group"
, set grouptypeid
text in each row. wrote:
var pcv = new pagedcollectionview(datagriddayview.itemssource); pcv.groupdescriptions.add(new propertygroupdescription("group")); datagriddayview.itemssource = pcv;
it doesn't work though. help?
to clarify. have:
ienumerable<docreghour> data; ienumerable<empidpaytypesettings> usersettings; var pcv = new pagedcollectionview(data); datagriddayview.itemssource = pcv;
which want group grouptypeid!, in different collection
if do:
// linq stuff need , group name give mydata.where(...).select(emp => new { group = emp.grouptypeid }); groupdescriptor descriptor = new groupdescriptor("group"); pcv.groupdescriptors.add(descriptor);
it should work. i'm not entirely sure though understood data-model. found anonymous types pretty handy when comes similar situations :)
Comments
Post a Comment