예제 #1
0
        public void GridColumn()
        {
            Grid GridSecond = new Grid();

            Testpage.Controls.Add(GridSecond);
            Grid gridPrimary = new Grid();

            GridSecond.ID               = "gridslave";
            GridSecond.DataSourceId     = "Orders";
            GridSecond.ConnectionString = ConnectionAccessOleDb;
            GridSecond.MasterGrid       = "wggrid";

            GridColumn column = new GridColumn("column", gridPrimary.MasterTable);

            column.UseAllRows      = true;
            column.ColumnId        = "wgMasterDetails";
            column.HideDetailTitle = true;
            column.GridId          = "gridslave";

            gridPrimary.MasterTable.Columns.Add(column);

            SetupGrid(gridPrimary);

            gridPrimary.DisplayView      = DisplayView.Detail;
            gridPrimary.EditIndex        = "4";
            gridPrimary.DataSourceId     = "Employees";
            gridPrimary.ConnectionString = ConnectionAccessOleDb;

            StringBuilder  sb         = new StringBuilder();
            StringWriter   sw         = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);

            gridPrimary.RenderControl(gridwriter);
            Assert.AreEqual(gridPrimary.MasterTable.Rows.Count, 1);
            Assert.Greater(GridSecond.MasterTable.Rows.Count, 1);
            Assert.LessOrEqual(gridPrimary.SystemMessage.Count, 1); // 15-day license key message
            Assert.AreEqual(gridPrimary.DisplayView, DisplayView.Detail);
            Assert.AreEqual(GridSecond.DisplayView, DisplayView.Grid);
        }
예제 #2
0
        public void GridColumn()
        {
            Grid GridSecond = new Grid();
            Testpage.Controls.Add(GridSecond);
            Grid gridPrimary = new Grid();

            GridSecond.ID = "gridslave";
            GridSecond.DataSourceId = "Orders";
            GridSecond.ConnectionString = ConnectionAccessOleDb;
            GridSecond.MasterGrid = "wggrid";

            GridColumn column = new GridColumn("column", gridPrimary.MasterTable);
            column.UseAllRows = true;
            column.ColumnId = "wgMasterDetails";
            column.HideDetailTitle = true;
            column.GridId = "gridslave";

            gridPrimary.MasterTable.Columns.Add(column);

            SetupGrid(gridPrimary);

            gridPrimary.DisplayView = DisplayView.Detail;
            gridPrimary.EditIndex = "4";
            gridPrimary.DataSourceId = "Employees";
            gridPrimary.ConnectionString = ConnectionAccessOleDb;

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            gridPrimary.RenderControl(gridwriter);
            Assert.AreEqual(gridPrimary.MasterTable.Rows.Count, 1);
            Assert.Greater(GridSecond.MasterTable.Rows.Count, 1);
            Assert.LessOrEqual(gridPrimary.SystemMessage.Count, 1); // 15-day license key message
            Assert.AreEqual(gridPrimary.DisplayView, DisplayView.Detail);
            Assert.AreEqual(GridSecond.DisplayView, DisplayView.Grid);
        }
예제 #3
0
 internal static Column GetColumnFromType(string columnName, Table table, ColumnType columnType)
 {
     Column column;
     switch (columnType)
     {
         case ColumnType.Text:
             column = new Text(columnName, table);
             break;
         case ColumnType.Number:
             column = new Number(columnName, table);
             break;
         case ColumnType.Decimal:
             column = new Decimal(columnName, table);
             break;
         case ColumnType.Checkbox:
             column = new Checkbox(columnName, table);
             break;
         case ColumnType.DateTime:
             column = new DateTime(columnName, table);
             break;
         case ColumnType.Foreignkey:
             column = new Foreignkey(columnName, table);
             break;
         case ColumnType.ManyToMany:
             column = new ManyToMany(columnName, table);
             break;
         case ColumnType.GridColumn:
             column = new GridColumn(columnName, table);
             break;
         case ColumnType.Chart:
             column = new Chart(columnName, table);
             break;
         case ColumnType.File:
             column = new File(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.Image:
             column = new Image(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.ToolTip:
             column = new ToolTipColumn(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.SystemColumn:
             column = new SystemColumn(columnName, Enums.SystemColumn.Undefined, table) { IsInDataSource = false };
             break;
         default:
             column = new UnknownColumn(columnName, table);
             break;
     }
     return column;
 }
예제 #4
0
 internal override Column Duplicate()
 {
     GridColumn c = new GridColumn(ColumnId, m_Table);
     CopyTo(c);
     return c;
 }