Exemplo n.º 1
0
        public void CheckboxColumn()
        {
            Grid grid = new Grid();

            Checkbox column = new Checkbox("column", grid.MasterTable);
            column.Required = true;
            column.Primarykey = true;
            Checkbox column2 = new Checkbox("column2", grid.MasterTable);
            Checkbox column3 = new Checkbox("column3", grid.MasterTable);
            Checkbox column4 = new Checkbox("column4", grid.MasterTable);

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);
            grid.MasterTable.Columns.Add(column3);
            grid.MasterTable.Columns.Add(column4);

            SetupGrid(grid);

            // Not allowed content
            grid.MasterTable.Rows[0]["column"].Value = "1";
            grid.MasterTable.Rows[0]["column2"].Value = "sdf30";
            grid.MasterTable.Rows[0]["column3"].Value = "TRUE";
            grid.MasterTable.Rows[0]["column4"].Value = "";

            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);
            grid.RaisePostBackEvent("RecordUpdateClick!!False");
            Assert.AreEqual(grid.SystemMessage.Count, 0);
        }
Exemplo n.º 2
0
        public void CheckboxColumn()
        {
            Grid grid = new Grid();

            Checkbox column = new Checkbox("column", grid.MasterTable);

            column.Required   = true;
            column.Primarykey = true;
            Checkbox column2 = new Checkbox("column2", grid.MasterTable);
            Checkbox column3 = new Checkbox("column3", grid.MasterTable);
            Checkbox column4 = new Checkbox("column4", grid.MasterTable);

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);
            grid.MasterTable.Columns.Add(column3);
            grid.MasterTable.Columns.Add(column4);

            SetupGrid(grid);

            // Not allowed content
            grid.MasterTable.Rows[0]["column"].Value  = "1";
            grid.MasterTable.Rows[0]["column2"].Value = "sdf30";
            grid.MasterTable.Rows[0]["column3"].Value = "TRUE";
            grid.MasterTable.Rows[0]["column4"].Value = "";

            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);
            grid.RaisePostBackEvent("RecordUpdateClick!!False");
            Assert.AreEqual(grid.SystemMessage.Count, 0);
        }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 // 2005.01.05 - Jorn - Denne skal ikke brukes....
 /*internal override Column	Duplicate()
 {
     Checkbox c = new Checkbox(this.ColumnId,this.Grid);
     c.CheckedAlias = this.CheckedAlias;
     c.UncheckedAlias = this.UncheckedAlias;
     this.CopyTo( c );
     return c;
 }*/
 // 2005.01.05 - Jorn - Denne er mye bedre! :D
 internal override Column Duplicate()
 {
     Checkbox c = new Checkbox(ColumnId, m_Table);
     CopyTo(c);
     return c;
 }