Exemple #1
0
    /// <summary>
    /// Inserts a grid row. Only cells required for the summary results
    /// will be created (except if GenerateAllCellsOnSummaryRow is true).
    /// The group will be checked for columns with summary
    /// </summary>
    /// <param name="beforeRow"></param>
    /// <param name="g"></param>
    /// <returns></returns>
    private GridViewRow InsertGridRow(GridViewRow beforeRow, GridViewGroup g)
    {
        int colspan;
        TableCell cell;
        TableCell[] tcArray;
        int visibleColumns = this.GetVisibleColumnCount();

        Table tbl = (Table)mGrid.Controls[0];
        int newRowIndex = tbl.Rows.GetRowIndex(beforeRow);
        GridViewRow newRow = new GridViewRow(newRowIndex, newRowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);

        if ( g != null && ( g.IsSuppressGroup || g.GenerateAllCellsOnSummaryRow ) )
        {
            // Create all the table cells
            tcArray = new TableCell[visibleColumns];
            for (int i = 0; i < visibleColumns; i++)
            {
                cell = new TableCell();
                cell.ApplyStyle(mGrid.Columns[GetRealIndexFromVisibleColumnIndex(i)].ItemStyle);
                cell.Text = "&nbsp;";
                tcArray[i] = cell;
            }
        }
        else
        {
            // Create only the required table cells
            colspan = 0;
            List<TableCell> tcc = new List<TableCell>();
            for (int i = 0; i < mGrid.Columns.Count; i++)
            {
                if (ColumnHasSummary(i, g))
                {
                    if (colspan > 0)
                    {
                        cell = new TableCell();
                        cell.Text = "&nbsp;";
                        cell.ColumnSpan = colspan;
                        tcc.Add(cell);
                        colspan = 0;
                    }

                    // insert table cell and copy the style
                    cell = new TableCell();
                    cell.ApplyStyle(mGrid.Columns[i].ItemStyle);
                    tcc.Add(cell);
                }
                else if (mGrid.Columns[i].Visible)
                {
                    // A visible column that will have no cell because has
                    // no summary. So we increase the colspan...
                    colspan++;
                }
            }

            if (colspan > 0)
            {
                cell = new TableCell();
                cell.Text = "&nbsp;";
                cell.ColumnSpan = colspan;
                tcc.Add(cell);
                colspan = 0;
            }

            tcArray = new TableCell[tcc.Count];
            tcc.CopyTo(tcArray);
        }

        newRow.Cells.AddRange(tcArray);
        tbl.Controls.AddAt(newRowIndex, newRow);

        return newRow;
    }
Exemple #2
0
        private TableCell CreateDayCell(CalendarDay day)
        {
            //initialize the cellstyles
            if (_cellStyles == null)
            {
                _cellStyles = new TableItemStyle[16];
            }

            //initialize style mask
            if (_definedStyleMask == 0)
            {
                _definedStyleMask = GetDefinedStyleMask();
            }

            int styleMask = STYLEMASK_DAY;

            if (day.IsOtherMonth)
            {
                styleMask |= STYLEMASK_OTHERMONTH;
            }
            if (day.IsToday)
            {
                styleMask |= STYLEMASK_TODAY;
            }
            if (day.IsWeekend)
            {
                styleMask |= STYLEMASK_WEEKEND;
            }
            int dayStyleMask = _definedStyleMask & styleMask;
            // determine the unique portion of the mask for the current calendar,
            // which will strip out the day style bit
            int dayStyleID = dayStyleMask & STYLEMASK_UNIQUE;

            TableItemStyle cellStyle = _cellStyles[dayStyleID];

            if (cellStyle == null)
            {
                cellStyle = new TableItemStyle();
                SetDayStyles(cellStyle, dayStyleMask, Unit.Percentage(14));
                _cellStyles[dayStyleID] = cellStyle;
            }

            TableCell cell = new TableCell();

            cell.ApplyStyle(cellStyle);


            DayNumberDiv div;

            if (dayLinkFormat.Length > 0)
            {
                div = new DayNumberDiv(day, dayLinkFormat);
            }
            else
            {
                div = new DayNumberDiv(day.DayNumberText);
            }
            div.ApplyStyle(DayNumberStyle);
            cell.Controls.Add(div);

            return(cell);
        }
Exemple #3
0
        public override string GetDesignTimeHtml()
        {
            StringWriter   sw     = new StringWriter();
            HtmlTextWriter writer = new HtmlTextWriter(sw);

            Table menu = new Table();

            menu.CellSpacing = menuInstance.ItemSpacing;
            menu.CellPadding = menuInstance.ItemPadding;

            // Display the Menu based on its specified Layout
            if (menuInstance.Layout == MenuLayout.Vertical)
            {
                for (int i = 1; i <= 5; i++)
                {
                    TableRow  tr = new TableRow();
                    TableCell td = new TableCell();
                    td.ApplyStyle(menuInstance.UnselectedMenuItemStyle);
                    // The style is overwritten by anything specifically set in menuitem
                    if (menuInstance.BackColor != Color.Empty)
                    {
                        td.BackColor = menuInstance.BackColor;
                    }
                    if (menuInstance.Font != null)
                    {
                        td.Font.CopyFrom(menuInstance.Font);
                    }
                    if (menuInstance.ForeColor != Color.Empty)
                    {
                        td.ForeColor = menuInstance.ForeColor;
                    }
                    if (menuInstance.Height != Unit.Empty)
                    {
                        td.Height = menuInstance.Height;
                    }
                    if (menuInstance.Width != Unit.Empty)
                    {
                        td.Width = menuInstance.Width;
                    }
                    if (menuInstance.CssClass != String.Empty)
                    {
                        td.CssClass = menuInstance.CssClass;
                    }
                    else if (menuInstance.DefaultCssClass != String.Empty)
                    {
                        td.CssClass = menuInstance.DefaultCssClass;
                    }
                    if (menuInstance.BorderColor != Color.Empty)
                    {
                        td.BorderColor = menuInstance.BorderColor;
                    }
                    if (menuInstance.BorderStyle != BorderStyle.NotSet)
                    {
                        td.BorderStyle = menuInstance.BorderStyle;
                    }
                    if (menuInstance.BorderWidth != Unit.Empty)
                    {
                        td.BorderWidth = menuInstance.BorderWidth;
                    }
                    td.Text = "Menu Item " + i.ToString();
                    tr.Cells.Add(td);
                    menu.Rows.Add(tr);
                }
            }
            else
            {
                TableRow tr = new TableRow();
                for (int i = 1; i <= 5; i++)
                {
                    TableCell td = new TableCell();
                    td.ApplyStyle(menuInstance.UnselectedMenuItemStyle);
                    // The style is overwritten by anything specifically set in menuitem
                    if (menuInstance.BackColor != Color.Empty)
                    {
                        td.BackColor = menuInstance.BackColor;
                    }
                    if (menuInstance.Font != null)
                    {
                        td.Font.CopyFrom(menuInstance.Font);
                    }
                    if (menuInstance.ForeColor != Color.Empty)
                    {
                        td.ForeColor = menuInstance.ForeColor;
                    }
                    if (menuInstance.Height != Unit.Empty)
                    {
                        td.Height = menuInstance.Height;
                    }
                    if (menuInstance.Width != Unit.Empty)
                    {
                        td.Width = menuInstance.Width;
                    }
                    if (menuInstance.CssClass != String.Empty)
                    {
                        td.CssClass = menuInstance.CssClass;
                    }
                    else if (menuInstance.DefaultCssClass != String.Empty)
                    {
                        td.CssClass = menuInstance.DefaultCssClass;
                    }
                    if (menuInstance.BorderColor != Color.Empty)
                    {
                        td.BorderColor = menuInstance.BorderColor;
                    }
                    if (menuInstance.BorderStyle != BorderStyle.NotSet)
                    {
                        td.BorderStyle = menuInstance.BorderStyle;
                    }
                    if (menuInstance.BorderWidth != Unit.Empty)
                    {
                        td.BorderWidth = menuInstance.BorderWidth;
                    }
                    td.Text = "Menu Item " + i.ToString();
                    tr.Cells.Add(td);
                }
                menu.Rows.Add(tr);
            }

            menu.RenderControl(writer);
            return(sw.ToString());
        }
        /// <summary>
        /// Inserts a grid row. Only cells required for the summary results
        /// will be created (except if GenerateAllCellsOnSummaryRow is true).
        /// The group will be checked for columns with summary
        /// </summary>
        /// <param name="beforeRow"></param>
        /// <param name="g"></param>
        /// <returns></returns>
        private GridViewRow InsertGridRow(GridViewRow beforeRow, GridViewGroup g)
        {
            int       colspan;
            TableCell cell;

            TableCell[] tcArray;
            int         visibleColumns = this.GetVisibleColumnCount();

            Table       tbl         = (Table)mGrid.Controls[0];
            int         newRowIndex = tbl.Rows.GetRowIndex(beforeRow);
            GridViewRow newRow      = new GridViewRow(newRowIndex, newRowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);

            if (g != null && (g.IsSuppressGroup || g.GenerateAllCellsOnSummaryRow))
            {
                // Create all the table cells
                tcArray = new TableCell[visibleColumns];
                for (int i = 0; i < visibleColumns; i++)
                {
                    cell = new TableCell();
                    cell.ApplyStyle(mGrid.Columns[GetRealIndexFromVisibleColumnIndex(i)].ItemStyle);
                    cell.Text  = "&nbsp;";
                    tcArray[i] = cell;
                }
            }
            else
            {
                // Create only the required table cells
                colspan = 0;
                List <TableCell> tcc = new List <TableCell>();
                for (int i = 0; i < mGrid.Columns.Count; i++)
                {
                    if (ColumnHasSummary(i, g))
                    {
                        if (colspan > 0)
                        {
                            cell            = new TableCell();
                            cell.Text       = "&nbsp;";
                            cell.ColumnSpan = colspan;
                            tcc.Add(cell);
                            colspan = 0;
                        }

                        // insert table cell and copy the style
                        cell = new TableCell();
                        cell.ApplyStyle(mGrid.Columns[i].ItemStyle);
                        tcc.Add(cell);
                    }
                    else if (mGrid.Columns[i].Visible)
                    {
                        // A visible column that will have no cell because has
                        // no summary. So we increase the colspan...
                        colspan++;
                    }
                }

                if (colspan > 0)
                {
                    cell            = new TableCell();
                    cell.Text       = "&nbsp;";
                    cell.ColumnSpan = colspan;
                    tcc.Add(cell);
                    colspan = 0;
                }

                tcArray = new TableCell[tcc.Count];
                tcc.CopyTo(tcArray);
            }

            newRow.Cells.AddRange(tcArray);
            tbl.Controls.AddAt(newRowIndex, newRow);

            return(newRow);
        }
Exemple #5
0
        public void Init(Control target, Style messageStyle)
        {
            UpdatePanel messageUpdatePanel = target.FindControl("messageUpdatePanel") as UpdatePanel;

            if (null == messageUpdatePanel)
            {
                messageUpdatePanel    = new UpdatePanel();
                messageUpdatePanel.ID = "messageUpdatePanel";
                target.Controls.Add(messageUpdatePanel);
                Table     messageTable = new Table();
                TableRow  messageRow   = new TableRow();
                TableCell messageCell  = new TableCell();
                messageCell.ApplyStyle(messageStyle);
                _message = new Label();
                messageCell.Controls.Add(this._message);
                messageRow.Cells.Add(messageCell);
                messageTable.Rows.Add(messageRow);
                messageUpdatePanel.ContentTemplateContainer.Controls.Add(messageTable);
            }

            UpdatePanel commandersUpdatePanel = target.FindControl("commandersUpdatePanel") as UpdatePanel;

            if (null == commandersUpdatePanel)
            {
                commandersUpdatePanel    = new UpdatePanel();
                commandersUpdatePanel.ID = "commandersUpdatePanel";
                target.Controls.Add(commandersUpdatePanel);
            }

            Panel commandersWrapper = commandersUpdatePanel.FindControl("commandersWrapper") as Panel;

            if (null == commandersWrapper)
            {
                commandersWrapper          = new Panel();
                commandersWrapper.ID       = "commandersWrapper";
                commandersWrapper.CssClass = "table-responsive";
                commandersUpdatePanel.ContentTemplateContainer.Controls.Add(commandersWrapper);
            }

            _commandersHolder = commandersWrapper.FindControl("commandersHolder");
            if (null == _commandersHolder)
            {
                _commandersHolder    = new Table();
                _commandersHolder.ID = "commandersHolder";
                ((Table)_commandersHolder).CssClass = "";
                commandersWrapper.Controls.Add(_commandersHolder);
            }

            _selectorsHolder = target.FindControl("selectorsHolder");
            if (null == _selectorsHolder)
            {
                _selectorsHolder    = new Table();
                _selectorsHolder.ID = "selectorsHolder";
                target.Controls.Add(this._selectorsHolder);
            }

            UpdatePanel updatePanel = target.FindControl("containerUpdatePanel") as UpdatePanel;

            if (null == updatePanel)
            {
                updatePanel    = new UpdatePanel();
                updatePanel.ID = "containerUpdatePanel";
                target.Controls.Add(updatePanel);
            }

            Panel wrapper = updatePanel.FindControl("containerWrapper") as Panel;

            if (null == wrapper)
            {
                wrapper          = new Panel();
                wrapper.ID       = "containerWrapper";
                wrapper.CssClass = "table-responsive";
                updatePanel.ContentTemplateContainer.Controls.Add(wrapper);
            }

            Table innerTable = wrapper.FindControl("innerTable") as Table;

            if (null == innerTable)
            {
                innerTable          = new Table();
                innerTable.ID       = "innerTable";
                innerTable.CssClass = "table table-striped table-hover table-condensed";
                wrapper.Controls.Add(innerTable);
            }

            if (null == this._container)
            {
                _container = innerTable;
            }
        }