Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objectlistview how to change the text in the group header?

I want to change the name of the group header but i cant find any solutions in the documentation or on google.

the text in the header should be a time which is summed up in the group.

this is how it should look like:

enter image description here

like image 971
Cortana Avatar asked Sep 25 '15 10:09

Cortana


1 Answers

the text in the header should be a time which is summed up in the group.

No problem :)

olv.AboutToCreateGroups += delegate(object sender, CreateGroupsEventArgs args) {
    foreach (OLVGroup olvGroup in args.Groups) {
        int totalTime = 0;

        foreach (OLVListItem item in olvGroup.Items) {
            // change this block accordingly
             MyRowObjectType rowObject = item.RowObject as MyRowObjectType;
             totalTime += rowObject.MyNumericProperty;
            // change this block accordingly
        }

        olvGroup.Header += String.Format(" (Total time = {0})", totalTime);
    }
};
like image 109
Rev Avatar answered Nov 12 '22 16:11

Rev