I have one SPGridView, on this grid, I'd like to have the group by based on the Managed Metadata column. But the display in the Group by line will contain the TermID like below:

Type: Testing|1e2f0ded-3e46-4bf1-94ea-8f92f5d90bb3

I'd like this like will display like:

Type: Testing

I've already used the ItemTemplateCustom to get the label, not the whole term. But I think it didn't affect the Group by line. Have you any solution on this case ?

1 Answer 1


Why not write JS code inside content editor & then get the HTML elements containing the GROUP BY text & then change it. You can use Jquery to do this

1) Get the TABLE by using


2) Loop through all the TBODY tags which have groupstring attribute as not null/empty. then you get the content inside the TD of qualifying TBODY & then do JS substring & replace the proper string using

$("TABLE.ms-listviewtable TBODY").each(function(){
    var isHavingGroup = $(this).attr("groupstring");
    if(isHavingGroup != null || isHavingGroup != "") {     
        var requiredTD = $(this).children().find("TD");
        var existing_text = requiredTD.text();
        //Do the substring - here you split & then use the text
        requiredTD.text(new string);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.