﻿            function AddSortColumn(repeaterId, parentName, columnsorted, columnsortedType) {
                
                if (columnsorted != null)
                { columnsorted = columnsorted.toLowerCase(); }
                $('#' + parentName + ' tr.cssGridHeader td,tr.cssGridHeader th').each(function(i) {
                    var cell = $(this);
                    var sortItem = cell.attr("sortItem");
                    if (sortItem != null) {
                        cell.addClass("Sortheader");
                        sortItem = sortItem.toLowerCase();
                        if (sortItem == columnsorted) {

                            cell.attr("sortType", columnsortedType);
                            
                            if (columnsortedType == 1) {
                                cell.addClass("headerSortUp");
                            }
                            if (columnsortedType == 0)
                            { cell.addClass("headerSortDown"); }

                        }
                        
                        cell.click(function() {


                            var sortType = cell.attr("sortType");

                            if (sortType != null) {
                                sortType = 0;
                            }
                            if (columnsortedType != null) {
                                sortType = columnsortedType;
                            }
                            
                            __doPostBack(repeaterId, sortItem + ',' + sortType);
                        });
                    }

                });
            }
            
    

