Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1180
grouping image with hidden column
posted

I have two columns in a Grid. The 1st column of type image and a second column of text that represents the image of the first column.
I wish when I group the first column of the grouping is done by hidden column.
There is how to do?

Parents
No Data
Reply
  • 469350
    Offline posted

    All you have to do is create an IComparer for the image column that compares the cells based on the values in the text column. Then you set the SortComparer on the image column to an instance of your IComparer class.

    The IComparer class would look something like this:


        public class MyComparer : IComparer
        {
            #region IComparer Members

            int IComparer.Compare(object x, object y)
            {
                UltraGridCell xCell = x as UltraGridCell;
                UltraGridCell yCell = y as UltraGridCell;

                if (xCell == yCell)
                    return 0;

                if (xCell == null)
                    return 1;
                else if (yCell == null)
                    return -1;

                string xString = xCell.Row.Cells["text Column"].Text;
                string yString = yCell.Row.Cells["text Column"].Text;

                return xString.CompareTo(yString);
            }

            #endregion
        }

Children