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
630
Sorting in UltraWebGrid
posted

Hi,

I am trying to do sorting in UltraWebGrid in C# code level. But it is not working properly.

Below is peice of code that i am using for sorting.

on clicking  on Column Header it goes to Sorting event handler, but sorting is not done properly.

if (ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo] != null)
{
     if (ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo].SortIndicator == SortIndicator.Ascending)
      {
            foreach(UltraGridColumn UltraCol in ugAccounts.Columns)
              {
                 UltraCol.SortIndicator = SortIndicator.None;
               }
                BindAccountsGrid();
                ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo].SortIndicator = SortIndicator.Descending;
                ugAccounts.Bands[e.BandNo].SortedColumns.Add(ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo], true);
     }
     else
       {
             foreach (UltraGridColumn UltraCol in ugAccounts.Columns)
              {
                   UltraCol.SortIndicator = SortIndicator.None;
              }
               BindAccountsGrid();
               ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo].SortIndicator = SortIndicator.Ascending;
               ugAccounts.Bands[e.BandNo].SortedColumns.Add(ugAccounts.Bands[e.BandNo].Columns[e.ColumnNo], true);
          }

 }

 

could you please provide me how to do sorting in UltraWebgrid, even if it is using javascript also, no problems to me?

Thanks in advance