Example #1
0
 public override void InitializeCell(TableCell cell, int fieldIndex, ListItemType itemType)
 {
     base.InitializeCell(cell, fieldIndex, itemType);
     if ((itemType != ListItemType.Header) && (itemType != ListItemType.Footer))
     {
         if (itemType == ListItemType.EditItem)
         {
             ControlCollection controls = cell.Controls;
             ButtonColumnType buttonType = this.ButtonType;
             WebControl child = null;
             if (buttonType == ButtonColumnType.LinkButton)
             {
                 LinkButton button = new MxDataGridLinkButton();
                 child = button;
                 button.CommandName = "Update";
                 button.Text = this.UpdateText;
             }
             else
             {
                 Button button2 = new Button();
                 child = button2;
                 button2.CommandName = "Update";
                 button2.Text = this.UpdateText;
             }
             controls.Add(child);
             LiteralControl control2 = new LiteralControl(" ");
             controls.Add(control2);
             if (buttonType == ButtonColumnType.LinkButton)
             {
                 LinkButton button3 = new MxDataGridLinkButton();
                 child = button3;
                 button3.CommandName = "Cancel";
                 button3.Text = this.CancelText;
                 button3.CausesValidation = false;
             }
             else
             {
                 Button button4 = new Button();
                 child = button4;
                 button4.CommandName = "Cancel";
                 button4.Text = this.CancelText;
                 button4.CausesValidation = false;
             }
             controls.Add(child);
         }
         else
         {
             ControlCollection controls2 = cell.Controls;
             ButtonColumnType type2 = this.ButtonType;
             WebControl control3 = null;
             if (type2 == ButtonColumnType.LinkButton)
             {
                 LinkButton button5 = new MxDataGridLinkButton();
                 control3 = button5;
                 button5.CommandName = "Edit";
                 button5.Text = this.EditText;
                 button5.CausesValidation = false;
             }
             else
             {
                 Button button6 = new Button();
                 control3 = button6;
                 button6.CommandName = "Edit";
                 button6.Text = this.EditText;
                 button6.CausesValidation = false;
             }
             controls2.Add(control3);
         }
     }
 }
Example #2
0
 public override void InitializeCell(TableCell cell, int fieldIndex, ListItemType itemType)
 {
     base.InitializeCell(cell, fieldIndex, itemType);
     if ((itemType != ListItemType.Header) && (itemType != ListItemType.Footer))
     {
         WebControl child = null;
         if (this.ButtonType == ButtonColumnType.LinkButton)
         {
             LinkButton button = new MxDataGridLinkButton();
             button.Text = this.Text;
             button.CommandName = this.CommandName;
             button.CausesValidation = false;
             child = button;
         }
         else
         {
             Button button2 = new Button();
             button2.Text = this.Text;
             button2.CommandName = this.CommandName;
             button2.CausesValidation = false;
             child = button2;
         }
         if (this.DataTextField.Length != 0)
         {
             child.DataBinding += new EventHandler(this.OnDataBindField);
         }
         cell.Controls.Add(child);
     }
 }
Example #3
0
 public virtual void InitializeCell(TableCell cell, int fieldIndex, ListItemType itemType)
 {
     WebControl control;
     switch (itemType)
     {
         case ListItemType.Header:
         {
             control = null;
             bool flag = true;
             string sortExpression = null;
             if ((this.owner != null) && !this.owner.AllowSorting)
             {
                 flag = false;
             }
             if (flag)
             {
                 sortExpression = this.SortExpression;
                 if (sortExpression.Length == 0)
                 {
                     flag = false;
                 }
             }
             string headerImageUrl = this.HeaderImageUrl;
             if (headerImageUrl.Length == 0)
             {
                 string headerText = this.HeaderText;
                 if (flag)
                 {
                     LinkButton button2 = new MxDataGridLinkButton();
                     button2.Text = headerText;
                     button2.CommandName = "Sort";
                     button2.CommandArgument = sortExpression;
                     button2.CausesValidation = false;
                     control = button2;
                 }
                 else
                 {
                     if (headerText.Length == 0)
                     {
                         headerText = " ";
                     }
                     cell.Text = headerText;
                 }
                 break;
             }
             if (flag)
             {
                 ImageButton button = new ImageButton();
                 button.ImageUrl = this.HeaderImageUrl;
                 button.CommandName = "Sort";
                 button.CommandArgument = sortExpression;
                 button.CausesValidation = false;
                 control = button;
             }
             else
             {
                 Image image = new Image();
                 image.ImageUrl = headerImageUrl;
                 control = image;
             }
             break;
         }
         case ListItemType.Footer:
         {
             string footerText = this.FooterText;
             if (footerText.Length == 0)
             {
                 footerText = " ";
             }
             cell.Text = footerText;
             return;
         }
         default:
             return;
     }
     if (control != null)
     {
         cell.Controls.Add(control);
     }
 }
Example #4
0
 protected virtual void InitializePager(MxDataGridItem item, int fieldSpan, PagedDataSource pagedDataSource)
 {
     TableCell cell = new TableCell();
     cell.ColumnSpan = fieldSpan;
     MxDataGridPagerStyle pagerStyle = this.PagerStyle;
     if (pagerStyle.Mode == PagerMode.NextPrev)
     {
         if (!pagedDataSource.IsFirstPage)
         {
             LinkButton child = new MxDataGridLinkButton();
             child.Text = pagerStyle.PrevPageText;
             child.CommandName = "Page";
             child.CommandArgument = "Prev";
             child.CausesValidation = false;
             cell.Controls.Add(child);
         }
         else
         {
             Label label = new Label();
             label.Text = pagerStyle.PrevPageText;
             cell.Controls.Add(label);
         }
         cell.Controls.Add(new LiteralControl(" "));
         if (!pagedDataSource.IsLastPage)
         {
             LinkButton button2 = new MxDataGridLinkButton();
             button2.Text = pagerStyle.NextPageText;
             button2.CommandName = "Page";
             button2.CommandArgument = "Next";
             button2.CausesValidation = false;
             cell.Controls.Add(button2);
         }
         else
         {
             Label label2 = new Label();
             label2.Text = pagerStyle.NextPageText;
             cell.Controls.Add(label2);
         }
     }
     else
     {
         LinkButton button3;
         int pageCount = pagedDataSource.PageCount;
         int num2 = pagedDataSource.CurrentPageIndex + 1;
         int pageButtonCount = pagerStyle.PageButtonCount;
         int num4 = pageButtonCount;
         if (pageCount < num4)
         {
             num4 = pageCount;
         }
         int num5 = 1;
         int num6 = num4;
         if (num2 > num6)
         {
             int num7 = pagedDataSource.CurrentPageIndex / pageButtonCount;
             num5 = (num7 * pageButtonCount) + 1;
             num6 = (num5 + pageButtonCount) - 1;
             if (num6 > pageCount)
             {
                 num6 = pageCount;
             }
             if (((num6 - num5) + 1) < pageButtonCount)
             {
                 num5 = Math.Max(1, (num6 - pageButtonCount) + 1);
             }
         }
         if (num5 != 1)
         {
             button3 = new MxDataGridLinkButton();
             button3.Text = "...";
             button3.CommandName = "Page";
             int num9 = num5 - 1;
             button3.CommandArgument = num9.ToString(NumberFormatInfo.InvariantInfo);
             button3.CausesValidation = false;
             cell.Controls.Add(button3);
             cell.Controls.Add(new LiteralControl("&nbsp;"));
         }
         for (int i = num5; i <= num6; i++)
         {
             string str = i.ToString(NumberFormatInfo.InvariantInfo);
             if (i == num2)
             {
                 Label label3 = new Label();
                 label3.Text = str;
                 cell.Controls.Add(label3);
             }
             else
             {
                 button3 = new MxDataGridLinkButton();
                 button3.Text = str;
                 button3.CommandName = "Page";
                 button3.CommandArgument = str;
                 button3.CausesValidation = false;
                 cell.Controls.Add(button3);
             }
             if (i < num6)
             {
                 cell.Controls.Add(new LiteralControl("&nbsp;"));
             }
         }
         if (pageCount > num6)
         {
             cell.Controls.Add(new LiteralControl("&nbsp;"));
             button3 = new MxDataGridLinkButton();
             button3.Text = "...";
             button3.CommandName = "Page";
             button3.CommandArgument = (num6 + 1).ToString(NumberFormatInfo.InvariantInfo);
             button3.CausesValidation = false;
             cell.Controls.Add(button3);
         }
     }
     item.Cells.Add(cell);
 }