示例#1
0
 protected void TodoContentGridView_Sorting(object sender, GridViewSortEventArgs e)
 {
     if (combinedContentItems.Count > 1)
     {
         //Sort the data.
         var           prop      = typeof(ContentModel).GetProperty(e.SortExpression);
         SortDirection direction = GetSortDirection(e.SortExpression);
         if (direction == SortDirection.Ascending)
         {
             combinedContentItems = combinedContentItems.OrderBy(ll => prop.GetValue(ll, null)).ToList();
         }
         else
         {
             combinedContentItems = combinedContentItems.OrderByDescending(ll => prop.GetValue(ll, null)).ToList();
         }
         TodoContentGridView.DataSource = combinedContentItems;
         TodoContentGridView.DataBind();
         int columnIndex = 0;
         foreach (DataControlFieldHeaderCell headerCell in TodoContentGridView.HeaderRow.Cells)
         {
             if (headerCell.ContainingField.SortExpression == e.SortExpression)
             {
                 columnIndex = TodoContentGridView.HeaderRow.Cells.GetCellIndex(headerCell);
             }
         }
         TodoContentGridView.HeaderRow.Cells[columnIndex].Controls.Add(sortImage);
     }
 }
示例#2
0
 private void renderTodoContentGridView()
 {
     HideMessage();
     TodoContentGridView.DataSource = combinedContentItems;
     TodoContentGridView.DataBind();
     TodoContentGridView.SelectedIndex = -1;
 }
示例#3
0
 protected void TodoContentGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     TodoContentGridView.DataSource = combinedContentItems;
     TodoContentGridView.PageIndex  = e.NewPageIndex;
     TodoContentGridView.DataBind();
 }