Example #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
            base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
            System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                base.GHTActiveSubTest = GHTSubTest1;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table1.ApplyStyle(myStyle);

                myStyle.CellSpacing   = 0;
                base.GHTActiveSubTest = GHTSubTest2;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table2.ApplyStyle(myStyle);

                myStyle.CellSpacing   = 9;
                base.GHTActiveSubTest = GHTSubTest3;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table3.ApplyStyle(myStyle);
            }

            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
 public override string GetDesignTimeHtml()
 {
     var style = new TableStyle();
     var table = new Table();
     var component = Component as DeluxeSearch;
     var writer = new StringWriter();
     var html = new HtmlTextWriter(writer);
     if (null != component)
     {
         if (component.Categories.Count > 0)
         {
             foreach (var item in component.Categories)
             {
                 var cell = new TableCell();
                 var row = new TableRow();
                 cell.Text = string.Format("{0}:{1}", item.DataTextField, item.DataSourceID);
                 row.Cells.Add(cell);
                 table.Rows.Add(row);
             }
         }
         else
         {
             var cell = new TableCell();
             var row = new TableRow();
             cell.Text = component.ID;
             row.Cells.Add(cell);
             table.Rows.Add(row);
         }
         table.ApplyStyle(style);              
         table.RenderControl(html);
     }
     return writer.ToString();
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
            base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
            System.Web.UI.WebControls.TableStyle tableStyle = new System.Web.UI.WebControls.TableStyle();
            tableStyle.CopyFrom(Table2.ControlStyle);
            Table1.ApplyStyle(tableStyle);

            base.GHTTestEnd();
        }
Example #4
0
        /// <summary>
        /// Gets the design time HTML code.
        /// </summary>
        /// <returns>A string containing the HTML to render.</returns>
        public override string GetDesignTimeHtml()
        {
            PagedControl pagerBuilder = (PagedControl)base.Component;

            StringBuilder stringBuilder = new StringBuilder();

            StringWriter   stringWriter = new StringWriter();
            HtmlTextWriter writer       = new HtmlTextWriter(stringWriter);

            // Initialize the structure.
            System.Web.UI.WebControls.Table     pagerPanel               = new System.Web.UI.WebControls.Table();
            System.Web.UI.WebControls.TableRow  pagerPanelRow            = new System.Web.UI.WebControls.TableRow();
            System.Web.UI.WebControls.TableCell pagerPanelInfoCell       = new System.Web.UI.WebControls.TableCell();
            System.Web.UI.WebControls.TableCell pagerPanelNavigationCell = new System.Web.UI.WebControls.TableCell();

            pagerPanelRow.Cells.Add(pagerPanelInfoCell);
            pagerPanelRow.Cells.Add(pagerPanelNavigationCell);

            pagerPanel.Rows.Add(pagerPanelRow);

            // Initialize structure appearance
            pagerPanel.ApplyStyle(pagerBuilder.PagerStyle);
            pagerPanel.Width           = pagerBuilder.Width;
            pagerPanel.Height          = pagerBuilder.Height;
            pagerPanel.HorizontalAlign = pagerBuilder.HorizontalAlign;

            pagerPanel.CellPadding = pagerBuilder.CellPadding;
            pagerPanel.CellSpacing = pagerBuilder.CellSpacing;

            pagerPanelRow.CssClass = pagerBuilder.PanelCssClass;

            //pagerBuilder.InfoPanelStyle.MergeWith(pagerBuilder.PagerStyle);
            //pagerPanelInfoCell.ApplyStyle(pagerBuilder.InfoPanelStyle);
            pagerPanelInfoCell.ApplyStyle(pagerBuilder.PagerStyle);
            pagerPanelInfoCell.HorizontalAlign = pagerBuilder.InfoPanelHorizontalAlign;
            pagerPanelInfoCell.VerticalAlign   = pagerBuilder.InfoPanelVerticalAlign;
            pagerPanelInfoCell.Visible         = !pagerBuilder.InfoPanelDisabled;

            //pagerBuilder.NavPanelStyle.MergeWith(pagerBuilder.PagerStyle);
            //pagerPanelNavigationCell.ApplyStyle(pagerBuilder.NavPanelStyle);
            pagerPanelNavigationCell.ApplyStyle(pagerBuilder.PagerStyle);
            pagerPanelNavigationCell.HorizontalAlign = pagerBuilder.NavPanelHorizontalAlign;
            pagerPanelNavigationCell.VerticalAlign   = pagerBuilder.NavPanelVerticalAlign;

            // Initialize the info panel
            pagerBuilder.BuildInfo(pagerPanelInfoCell, true);

            // Initialize the navigation panel
            pagerBuilder.BuildNavigation(pagerPanelNavigationCell);

            // Add the whole structure to the control collection
            pagerPanel.RenderControl(writer);

            return(stringWriter.ToString());
        }
Example #5
0
        // All the .NET API related methods.
        #region DOTNET API
        /// <summary>
        /// Create the child controls.
        /// </summary>
        protected override void CreateChildControls()
        {
            //PrintStatus();

            // Initialize the structure.
            System.Web.UI.WebControls.Table     pagerPanel               = new System.Web.UI.WebControls.Table();
            System.Web.UI.WebControls.TableRow  pagerPanelRow            = new System.Web.UI.WebControls.TableRow();
            System.Web.UI.WebControls.TableCell pagerPanelInfoCell       = new System.Web.UI.WebControls.TableCell();
            System.Web.UI.WebControls.TableCell pagerPanelNavigationCell = new System.Web.UI.WebControls.TableCell();

            pagerPanelRow.Cells.Add(pagerPanelInfoCell);
            pagerPanelRow.Cells.Add(pagerPanelNavigationCell);

            pagerPanel.Rows.Add(pagerPanelRow);

            // Initialize structure appearance
            pagerPanel.ApplyStyle(this.PagerStyle);
            pagerPanel.Width           = this.Width;
            pagerPanel.Height          = this.Height;
            pagerPanel.HorizontalAlign = this.HorizontalAlign;

            pagerPanel.CellPadding = CellPadding;
            pagerPanel.CellSpacing = CellSpacing;
            pagerPanel.BorderWidth = BorderWidth;
            pagerPanel.CssClass    = CssClass;

            pagerPanelRow.CssClass = PanelCssClass;

            //this.InfoPanelStyle.MergeWith(this.PagerStyle);
            //pagerPanelInfoCell.ApplyStyle(this.InfoPanelStyle);
            pagerPanelInfoCell.ApplyStyle(this.PagerStyle);
            pagerPanelInfoCell.HorizontalAlign = InfoPanelHorizontalAlign;
            pagerPanelInfoCell.VerticalAlign   = InfoPanelVerticalAlign;
            pagerPanelInfoCell.Visible         = !this.InfoPanelDisabled;

            //this.NavPanelStyle.MergeWith(this.PagerStyle);
            //pagerPanelNavigationCell.ApplyStyle(this.NavPanelStyle);
            pagerPanelNavigationCell.ApplyStyle(this.PagerStyle);
            pagerPanelNavigationCell.HorizontalAlign = NavPanelHorizontalAlign;
            pagerPanelNavigationCell.VerticalAlign   = NavPanelVerticalAlign;
            pagerPanelNavigationCell.Visible         = !this.NavPanelDisabled;

            // Initialize the info panel
            BuildInfo(pagerPanelInfoCell, false);

            // Initialize the navigation panel
            BuildNavigation(pagerPanelNavigationCell);

            // Add the whole structure to the control collection
            this.Controls.Add(pagerPanel);

            //PrintStatus();
        }
 protected internal override void RenderContents(HtmlTextWriter writer)
 {
     if (this.Controls.Count != 0)
     {
         RepeatInfo info         = new RepeatInfo();
         Table      table        = null;
         Style      controlStyle = base.ControlStyle;
         if (this.extractTemplateRows)
         {
             info.RepeatDirection   = System.Web.UI.WebControls.RepeatDirection.Vertical;
             info.RepeatLayout      = System.Web.UI.WebControls.RepeatLayout.Flow;
             info.RepeatColumns     = 1;
             info.OuterTableImplied = true;
             table = new Table {
                 ID = this.ClientID
             };
             table.CopyBaseAttributes(this);
             table.Caption      = this.Caption;
             table.CaptionAlign = this.CaptionAlign;
             table.ApplyStyle(controlStyle);
             table.RenderBeginTag(writer);
         }
         else
         {
             info.RepeatDirection = this.RepeatDirection;
             info.RepeatLayout    = this.RepeatLayout;
             info.RepeatColumns   = this.RepeatColumns;
             if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table)
             {
                 info.Caption             = this.Caption;
                 info.CaptionAlign        = this.CaptionAlign;
                 info.UseAccessibleHeader = this.UseAccessibleHeader;
             }
             else
             {
                 info.EnableLegacyRendering = base.EnableLegacyRendering;
             }
         }
         info.RenderRepeater(writer, this, controlStyle, this);
         if (table != null)
         {
             table.RenderEndTag(writer);
         }
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
            base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
            System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                base.GHTSubTestBegin("TableStyle - BackImageUrl");
                base.GHTActiveSubTest.Controls.Add(Table1);

                myStyle.BackImageUrl = "c:\\NoSuchImage.blabla";
                base.GHTSubTestAddResult(myStyle.BackImageUrl.ToString());
                Table1.ApplyStyle(myStyle);
            }

            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
Example #8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
            base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
            System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                myStyle.HorizontalAlign = HorizontalAlign.Center;
                base.GHTActiveSubTest   = GHTSubTest1;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table1.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Justify;
                base.GHTActiveSubTest   = GHTSubTest2;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table2.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Left;
                base.GHTActiveSubTest   = GHTSubTest3;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table3.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.NotSet;
                base.GHTActiveSubTest   = GHTSubTest4;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table4.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Right;
                base.GHTActiveSubTest   = GHTSubTest5;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table5.ApplyStyle(myStyle);
            }
            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
Example #9
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if ((config as IConfigurationSection).Elements.ContainsKey("totals"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
             table.ApplyStyle(templatable.TotalsStyle);
         }
         IConfigurationElement element = (config as IConfigurationSection).GetElementReference("totals");
         foreach (IConfigurationElement rowElement in element.Elements.Values)
         {
             this.DisplayItem(table, rowElement, "totals" + itemIndex.ToString(), binder, item, templatable.TotalsRowStyle, templatable.InvalidItemStyle, manager);
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
 protected internal override void Render(HtmlTextWriter writer)
 {
     bool isEnabled;
     this.threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
     this.minSupportedDate = this.threadCalendar.MinSupportedDateTime;
     this.maxSupportedDate = this.threadCalendar.MaxSupportedDateTime;
     DateTime visibleDate = this.EffectiveVisibleDate();
     DateTime firstDay = this.FirstCalendarDay(visibleDate);
     CalendarSelectionMode selectionMode = this.SelectionMode;
     if (this.Page != null)
     {
         this.Page.VerifyRenderingInServerForm(this);
     }
     if ((this.Page == null) || base.DesignMode)
     {
         isEnabled = false;
     }
     else
     {
         isEnabled = base.IsEnabled;
     }
     this.defaultForeColor = this.ForeColor;
     if (this.defaultForeColor == Color.Empty)
     {
         this.defaultForeColor = DefaultForeColor;
     }
     this.defaultButtonColorText = ColorTranslator.ToHtml(this.defaultForeColor);
     Table table = new Table();
     if (this.ID != null)
     {
         table.ID = this.ClientID;
     }
     table.CopyBaseAttributes(this);
     if (base.ControlStyleCreated)
     {
         table.ApplyStyle(base.ControlStyle);
     }
     table.Width = this.Width;
     table.Height = this.Height;
     table.CellPadding = this.CellPadding;
     table.CellSpacing = this.CellSpacing;
     if ((!base.ControlStyleCreated || !base.ControlStyle.IsSet(0x20)) || this.BorderWidth.Equals(Unit.Empty))
     {
         table.BorderWidth = Unit.Pixel(1);
     }
     if (this.ShowGridLines)
     {
         table.GridLines = GridLines.Both;
     }
     else
     {
         table.GridLines = GridLines.None;
     }
     bool useAccessibleHeader = this.UseAccessibleHeader;
     if (useAccessibleHeader && (table.Attributes["title"] == null))
     {
         table.Attributes["title"] = System.Web.SR.GetString("Calendar_TitleText");
     }
     string caption = this.Caption;
     if (caption.Length > 0)
     {
         table.Caption = caption;
         table.CaptionAlign = this.CaptionAlign;
     }
     table.RenderBeginTag(writer);
     if (this.ShowTitle)
     {
         this.RenderTitle(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     }
     if (this.ShowDayHeader)
     {
         this.RenderDayHeader(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     }
     this.RenderDays(writer, firstDay, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     table.RenderEndTag(writer);
 }
Example #11
0
        /// <summary>
        /// Builds the UI of the control
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            // A context menu is an invisible DIV that is moved around via scripting when the user
            // right-clicks on a bound HTML tag
            HtmlGenericControl div = new HtmlGenericControl("div");
            div.ID = "Root";
            div.Style["display"] = "none";
            div.Style["position"] = "absolute";
            div.Style["text-align"] = "left";
            if (AutoHide)
                div.Attributes["onmouseleave"] = "this.style.display='none'";

            Table menu = new Table();
            menu.ApplyStyle(CreateControlStyle());
            menu.CellSpacing = 1;
            menu.CellPadding = CellPadding;
            div.Controls.Add(menu);

            // Loop on ContextMenuItems and add rows to the table
            foreach(ContextMenuItem item in ContextMenuItems)
            {
                // Create and add the menu item
                TableRow menuItem = new TableRow();
                menu.Rows.Add(menuItem);

                // Configure the menu item
                TableCell container = new TableCell();
                menuItem.Cells.Add(container);

                // Define the menu item's contents
                if( item.Text == String.Empty || item.Text == null)
                {
                    // Empty item is a separator
                    container.Controls.Add(new LiteralControl(ContextMenu.HrSeparator));
                }
                else
                {
                    // Add roll-over capabilities
                    container.Attributes["onmouseover"] = String.Format(ContextMenu.OnMouseOver, ColorTranslator.ToHtml(RolloverColor));
                    container.Attributes["onmouseout"] = String.Format(ContextMenu.OnMouseOut, ColorTranslator.ToHtml(BackColor));

                    // Add the link for post back
                    LinkButton button = new LinkButton();
                    container.Controls.Add(button);
                    button.Click += new EventHandler(ButtonClicked);
                    button.Width = Unit.Percentage(100);
                    button.ToolTip = item.Tooltip;
                    button.Text = item.Text;
                    button.CommandName = item.CommandName;
                    button.CommandArgument = this.UniqueID;
                }
            }

            // Add the button to the control's hierarchy for display
            Controls.Add(div);

            // Inject any needed script code into the page
            EmbedScriptCode();

            // Inject the script code for all bound controls
            foreach(Control c in BoundControls)
            {
                WebControl ctl1 = (c as WebControl);
                HtmlControl ctl2 = (c as HtmlControl);

                if (ctl1 != null)
                    ctl1.Attributes["oncontextmenu"] = GetMenuReference();

                if (ctl2 != null)
                    ctl2.Attributes["oncontextmenu"] = GetMenuReference();
            }
        }
Example #12
0
        /// <internalonly/>
        /// <devdoc>
        /// <para>Displays the <see cref='System.Web.UI.WebControls.Calendar'/> control on the client.</para>
        /// </devdoc>
        protected internal override void Render(HtmlTextWriter writer) {
            threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
            minSupportedDate = threadCalendar.MinSupportedDateTime;
            maxSupportedDate = threadCalendar.MaxSupportedDateTime;
#if DEBUG
            threadCalendarInitialized = true;
#endif
            DateTime visibleDate = EffectiveVisibleDate();
            DateTime firstDay = FirstCalendarDay(visibleDate);
            CalendarSelectionMode selectionMode = SelectionMode;

            // Make sure we are in a form tag with runat=server.
            if (Page != null) {
                Page.VerifyRenderingInServerForm(this);
            }

            // We only want to display the link if we have a page, or if we are on the design surface
            // If we can stops links being active on the Autoformat dialog, then we can remove this these checks.
            Page page = Page;
            bool buttonsActive;
            if (page == null || DesignMode) {
                buttonsActive = false;
            }
            else {
                buttonsActive = IsEnabled;
            }

            defaultForeColor = ForeColor;
            if (defaultForeColor == Color.Empty) {
                defaultForeColor = DefaultForeColor;
            }
            defaultButtonColorText = ColorTranslator.ToHtml(defaultForeColor);

            Table table = new Table();

            if (ID != null) {
                table.ID = ClientID;
            }
            table.CopyBaseAttributes(this);
            if (ControlStyleCreated) {
                table.ApplyStyle(ControlStyle);
            }
            table.Width = Width;
            table.Height = Height;
            table.CellPadding = CellPadding;
            table.CellSpacing = CellSpacing;

            // default look
            if ((ControlStyleCreated == false) ||
                (ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_BORDERWIDTH) == false) ||
                BorderWidth.Equals(Unit.Empty)) {
                table.BorderWidth = Unit.Pixel(1);
            }

            if (ShowGridLines) {
                table.GridLines = GridLines.Both;
            }
            else {
                table.GridLines = GridLines.None;
            }

            bool useAccessibleHeader = UseAccessibleHeader;
            if (useAccessibleHeader) {
                if (table.Attributes["title"] == null) {
                    table.Attributes["title"] = SR.GetString(SR.Calendar_TitleText);
                }
            }

            string caption = Caption;
            if (caption.Length > 0) {
                table.Caption = caption;
                table.CaptionAlign = CaptionAlign;
            }

            table.RenderBeginTag(writer);

            if (ShowTitle) {
                RenderTitle(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
            }

            if (ShowDayHeader) {
                RenderDayHeader(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
            }

            RenderDays(writer, firstDay, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);

            table.RenderEndTag(writer);
        }
Example #13
0
        void WriteTitle(HtmlTextWriter writer, bool enabled)
        {
            TableCell cellNextPrev = null;
            TableCell titleCell    = new TableCell();
            Table     tableTitle   = new Table();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            titleCell.ColumnSpan = HasWeekSelectors(SelectionMode) ? 8 : 7;

            if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty)
            {
                titleCell.BackColor = titleStyle.BackColor;
            }
            else
            {
                titleCell.BackColor = Color.Silver;
            }

            titleCell.RenderBeginTag(writer);

            // Table
            tableTitle.Width = Unit.Percentage(100);
            if (titleStyle != null && !titleStyle.IsEmpty)
            {
                tableTitle.ApplyStyle(titleStyle);
            }

            tableTitle.RenderBeginTag(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            if (ShowNextPrevMonth)               // Previous Table Data
            {
                cellNextPrev = new TableCell();
                cellNextPrev.ApplyStyle(nextPrevStyle);
                cellNextPrev.Width = Unit.Percentage(15);

                DateTime date = GetGlobalCalendar().AddMonths(DisplayDate, -1);
                date = GetGlobalCalendar().AddDays(date, -date.Day + 1);
                cellNextPrev.RenderBeginTag(writer);
                writer.Write(BuildLink("V" + GetDaysFromZenith(date), GetNextPrevFormatText(date, false), cellNextPrev.ForeColor, enabled));
                cellNextPrev.RenderEndTag(writer);
            }

            // Current Month Table Data
            {
                DateTimeFormatInfo dti = DateInfo;
                string             str;
                TableCell          cellMonth = new TableCell();
                cellMonth.Width           = Unit.Percentage(70);
                cellMonth.HorizontalAlign = HorizontalAlign.Center;

                cellMonth.RenderBeginTag(writer);

                if (TitleFormat == TitleFormat.MonthYear)
                {
                    str = DisplayDate.ToString(dti.YearMonthPattern, dti);
                }
                else
                {
                    str = dti.GetMonthName(GetGlobalCalendar().GetMonth(DisplayDate));
                }

                writer.Write(str);
                cellMonth.RenderEndTag(writer);
            }

            if (ShowNextPrevMonth)               // Next Table Data
            {
                DateTime date = GetGlobalCalendar().AddMonths(DisplayDate, +1);
                date = GetGlobalCalendar().AddDays(date, -date.Day + 1);

                cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
                cellNextPrev.RenderBeginTag(writer);
                writer.Write(BuildLink("V" + GetDaysFromZenith(date), GetNextPrevFormatText(date, true), cellNextPrev.ForeColor, enabled));
                cellNextPrev.RenderEndTag(writer);
            }

            writer.RenderEndTag();
            tableTitle.RenderEndTag(writer);
            titleCell.RenderEndTag(writer);
            writer.RenderEndTag();              //tr
        }
Example #14
0
        /*********************************************************************************
        *
        * Calendar rendering methods
        *
        *********************************************************************************/
        //Creates the table for the calendar
        private Table CreateTable(DateTime visibleDate, DateTime firstDay, System.Globalization.Calendar threadCalendar)
        {
            Color defaultColor = ForeColor;
            if (defaultColor == Color.Empty)
            {
                defaultColor = Color.Black;
            }
            defaultButtonColorText = ColorTranslator.ToHtml(defaultColor);

            Table table = new Table();

            if (ID != null)
            {
                table.ID = ClientID;
            }
            table.CopyBaseAttributes(this);
            if (ControlStyleCreated)
            {
                table.ApplyStyle(ControlStyle);
            }
            table.Width = Width;
            table.Height = Height;
            table.CellPadding = CellPadding;
            table.CellSpacing = CellSpacing;

            // default look
            if ((ControlStyleCreated == false) ||
                BorderWidth.Equals(Unit.Empty))
            {
                table.BorderWidth = Unit.Pixel(1);
            }

            if (ShowGridLines)
            {
                table.GridLines = GridLines.Both;
            }
            else
            {
                table.GridLines = GridLines.None;
            }

            bool useAccessibleHeader = UseAccessibleHeader;
            if (useAccessibleHeader)
            {
                if (table.Attributes["title"] == null)
                {
                    table.Attributes["title"] = string.Empty;
                }
            }

            string caption = Caption;
            if (caption.Length > 0)
            {
                table.Caption = caption;
                table.CaptionAlign = CaptionAlign;
            }

            if (ShowTitle)
            {
                table.Rows.Add(CreateTitleRow(visibleDate, threadCalendar));
            }

            if (ShowDayHeader)
            {
                table.Rows.Add(CreateDayHeader(firstDay, visibleDate, threadCalendar));
            }

            return table;
        }
Example #15
0
		protected override void Render(HtmlTextWriter writer)
		{
			globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
			DateTime visDate   = GetEffectiveVisibleDate();
			DateTime firstDate = GetFirstCalendarDay(visDate);

			bool isEnabled;
			bool isHtmlTextWriter;
			//FIXME: when Control.Site works, reactivate this
			//if (Page == null || Site == null) {
			//	isEnabled = false;
			//	isHtmlTextWriter = false;
			//} else {
				isEnabled = Enabled;
				isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
			//}
			defaultTextColor = ForeColor;
			if(defaultTextColor == Color.Empty)
				defaultTextColor = Color.Black;

			Table calTable = new Table ();
			calTable.ID = ID;
			calTable.CopyBaseAttributes(this);
			if(ControlStyleCreated)
				calTable.ApplyStyle(ControlStyle);
			calTable.Width = Width;
			calTable.Height = Height;
			calTable.CellSpacing = CellSpacing;
			calTable.CellPadding = CellPadding;

			if (ControlStyleCreated &&
			    ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
			    BorderWidth != Unit.Empty)
				calTable.BorderWidth = BorderWidth;
			else
				calTable.BorderWidth = Unit.Pixel(1);

			if (ShowGridLines)
				calTable.GridLines = GridLines.Both;
			else
				calTable.GridLines = GridLines.None;
				
#if NET_2_0
			calTable.Caption = Caption;
			calTable.CaptionAlign = CaptionAlign;
#endif

			calTable.RenderBeginTag (writer);

			if (ShowTitle)
				RenderTitle (writer, visDate, SelectionMode, isEnabled);

			if (ShowDayHeader)
				RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);

			RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);

			calTable.RenderEndTag(writer);
		}
Example #16
0
		protected override void RenderContents (HtmlTextWriter writer)
		{
			if (Controls.Count == 0)
				return;

			RepeatInfo repeater = new RepeatInfo ();
			Table templateTable = null;
			if (extractTemplateRows) {
				repeater.RepeatDirection = RepeatDirection.Vertical;
				repeater.RepeatLayout  = RepeatLayout.Flow;
				repeater.RepeatColumns = 1;
				repeater.OuterTableImplied = true;
				
				templateTable = new Table ();
				templateTable.ID = ClientID;
				templateTable.CopyBaseAttributes (this);
				templateTable.ApplyStyle (ControlStyle);
				templateTable.RenderBeginTag (writer);
			} else {
				repeater.RepeatDirection = RepeatDirection;
				repeater.RepeatLayout = RepeatLayout;
				repeater.RepeatColumns = RepeatColumns;
			}

			repeater.RenderRepeater (writer, this, ControlStyle, this);
			if (templateTable != null) {
				templateTable.RenderEndTag (writer);
			}
		}
 private string ConvertTableToHtmlTable(Table originalTable, System.Web.UI.Control container, IDictionary persistMap)
 {
     IList list = new ArrayList();
     foreach (System.Web.UI.Control control in originalTable.Controls)
     {
         list.Add(control);
     }
     Table child = new Table();
     foreach (System.Web.UI.Control control2 in list)
     {
         child.Controls.Add(control2);
     }
     if (originalTable.ControlStyleCreated)
     {
         child.ApplyStyle(originalTable.ControlStyle);
     }
     child.Width = ((WebControl) base.ViewControl).Width;
     child.Height = ((WebControl) base.ViewControl).Height;
     if (container != null)
     {
         container.Controls.Add(child);
         container.Controls.Remove(originalTable);
     }
     IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (persistMap != null)
     {
         foreach (string str in persistMap.Keys)
         {
             System.Web.UI.Control control3 = child.FindControl(str);
             if ((control3 != null) && control3.Visible)
             {
                 control3.ID = (string) persistMap[str];
                 LiteralControl control4 = new LiteralControl(ControlPersister.PersistControl(control3, service));
                 control3.Parent.Controls.Add(control4);
                 control3.Parent.Controls.Remove(control3);
             }
         }
     }
     foreach (string str3 in _persistedControlIDs)
     {
         System.Web.UI.Control control5 = child.FindControl(str3);
         if (control5 != null)
         {
             if (Array.IndexOf<string>(_persistedIfNotVisibleControlIDs, str3) >= 0)
             {
                 control5.Visible = true;
                 control5.Parent.Visible = true;
                 control5.Parent.Parent.Visible = true;
             }
             if (str3 == "ErrorMessage")
             {
                 TableCell parent = (TableCell) control5.Parent;
                 parent.ForeColor = Color.Red;
                 parent.ApplyStyle(this._createUserWizard.ErrorMessageStyle);
                 control5.EnableViewState = false;
             }
             if (control5.Visible)
             {
                 LiteralControl control6 = new LiteralControl(ControlPersister.PersistControl(control5, service));
                 control5.Parent.Controls.Add(control6);
                 control5.Parent.Controls.Remove(control5);
             }
         }
     }
     StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
     HtmlTextWriter writer2 = new HtmlTextWriter(writer);
     child.RenderControl(writer2);
     return writer.ToString();
 }
		void WriteTitle (HtmlTextWriter writer)
		{
			TableCell cellNextPrev = null;
			TableCell titleCell = new TableCell ();
			Table tableTitle = new Table ();

			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			titleCell.ColumnSpan = HasWeekSelectors (SelectionMode) ? 8 : 7;

			if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty) {
				titleCell.BackColor = titleStyle.BackColor;
			} else {
				titleCell.BackColor = Color.Silver;
			}

			titleCell.RenderBeginTag (writer);

			// Table
			tableTitle.Width =  Unit.Percentage (100);
			if (titleStyle != null && !titleStyle.IsEmpty) {
				tableTitle.ApplyStyle (titleStyle);
			}

			tableTitle.RenderBeginTag (writer);
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			if (ShowNextPrevMonth) { // Previous Table Data
				cellNextPrev = new TableCell ();
				cellNextPrev.ApplyStyle (nextPrevStyle);
				cellNextPrev.Width = Unit.Percentage (15);

				DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, - 1);
				date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);
				cellNextPrev.RenderBeginTag (writer);
				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, false), cellNextPrev.ForeColor, Enabled));
				cellNextPrev.RenderEndTag (writer);
			}

			// Current Month Table Data
			{
				DateTimeFormatInfo dti = DateInfo;
				string str;
				TableCell cellMonth = new TableCell ();
				cellMonth.Width = Unit.Percentage (70);
				cellMonth.HorizontalAlign = HorizontalAlign.Center;

				cellMonth.RenderBeginTag (writer);

				if (TitleFormat == TitleFormat.MonthYear)
					str = DisplayDate.ToString (dti.YearMonthPattern, dti);
				else
					str = dti.GetMonthName (GetGlobalCalendar ().GetMonth (DisplayDate));

				writer.Write (str);
				cellMonth.RenderEndTag (writer);
			}

			if (ShowNextPrevMonth) { // Next Table Data
				DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, + 1);
				date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);

				cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
				cellNextPrev.RenderBeginTag (writer);
				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, true), cellNextPrev.ForeColor, Enabled));
				cellNextPrev.RenderEndTag (writer);
			}

			writer.RenderEndTag ();
			tableTitle.RenderEndTag (writer);
			titleCell.RenderEndTag (writer);
			writer.RenderEndTag (); //tr

		}
Example #19
0
        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void RenderContents(HtmlTextWriter writer) {
            if (Controls.Count == 0)
                return;

            RepeatInfo repeatInfo = new RepeatInfo();
            Table outerTable = null;

            // NOTE: This will end up creating the ControlStyle... Ideally we would
            //       not create the style just for rendering, but turns out our default
            //       style isn't empty, and does have an effect on rendering, and must
            //       therefore always be created
            Style style = ControlStyle;

            if (extractTemplateRows) {
                // The table tags in the templates are stripped out and only the
                // <tr>'s and <td>'s are assumed to come from the template itself.
                // This is equivalent to a flow layout of <tr>'s in a single
                // vertical column.

                repeatInfo.RepeatDirection = RepeatDirection.Vertical;
                repeatInfo.RepeatLayout = RepeatLayout.Flow;
                repeatInfo.RepeatColumns = 1;

                repeatInfo.OuterTableImplied = true;
                outerTable = new Table();

                // use ClientID (and not ID) since we want to render the fully qualified
                // ID even though the control will not be parented to the control hierarchy
                outerTable.ID = ClientID;

                outerTable.CopyBaseAttributes(this);
                outerTable.Caption = Caption;
                outerTable.CaptionAlign = CaptionAlign;
                outerTable.ApplyStyle(style);
                outerTable.RenderBeginTag(writer);
            }
            else {
                repeatInfo.RepeatDirection = RepeatDirection;
                repeatInfo.RepeatLayout = RepeatLayout;
                repeatInfo.RepeatColumns = RepeatColumns;
                if (repeatInfo.RepeatLayout == RepeatLayout.Table) {
                    repeatInfo.Caption = Caption;
                    repeatInfo.CaptionAlign = CaptionAlign;
                    repeatInfo.UseAccessibleHeader = UseAccessibleHeader;
                }
                else {
                    repeatInfo.EnableLegacyRendering = EnableLegacyRendering;
                }
            }

            repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this);
            if (outerTable != null)
                outerTable.RenderEndTag(writer);
        }
Example #20
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     this.updatePanel = new UpdatePanel();
     this.updatePanel.ID = "updatePanel";
     Table table = new Table();
     table.ApplyStyle(this._tableStyle);
     TableRow tableRow = new TableRow();
     TableCell tableCell = new TableCell();
     this.hiddenResultsCount = new HiddenField();
     this.hiddenResultsCount.ID = "hiddenResultsCount";
     tableCell.Controls.Add(this.hiddenResultsCount);
     this.hiddenCurrentPage = new HiddenField();
     this.hiddenCurrentPage.ID = "hiddenCurrentPage";
     tableCell.Controls.Add(this.hiddenCurrentPage);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.firstButton = new Button();
     this.firstButton.CssClass = "paginater_first";
     this.firstButton.Click += new EventHandler(this.firstButton_Click);
     tableCell.Controls.Add(this.firstButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.backwardButton = new Button();
     this.backwardButton.CssClass = "paginater_left";
     this.backwardButton.Click += new EventHandler(this.backwardButton_Click);
     tableCell.Controls.Add(this.backwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.currentLabel = new Label();
     this.currentLabel.ApplyStyle(this._labelStyle);
     this.currentLabel.Text = "0";
     tableCell.Controls.Add(this.currentLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.ofLabel = new Label();
     this.ofLabel.ApplyStyle(this._labelStyle);
     this.ofLabel.Text = this._ofText;
     tableCell.Controls.Add(this.ofLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.totalLabel = new Label();
     this.totalLabel.ApplyStyle(this._labelStyle);
     this.totalLabel.Text = "0";
     tableCell.Controls.Add(this.totalLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.forwardButton = new Button();
     this.forwardButton.CssClass = "paginater_right";
     this.forwardButton.Click += new EventHandler(this.forwardButton_Click);
     tableCell.Controls.Add(this.forwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.lastButton = new Button();
     this.lastButton.CssClass = "paginater_last";
     this.lastButton.Click += new EventHandler(this.lastButton_Click);
     tableCell.Controls.Add(this.lastButton);
     tableRow.Controls.Add(tableCell);
     table.Rows.Add(tableRow);
     this.updatePanel.ContentTemplateContainer.Controls.Add(table);
     this.Controls.Add(this.updatePanel);
 }
 protected internal override void RenderContents(HtmlTextWriter writer)
 {
     if (this.Controls.Count != 0)
     {
         RepeatInfo info = new RepeatInfo();
         Table table = null;
         Style controlStyle = base.ControlStyle;
         if (this.extractTemplateRows)
         {
             info.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical;
             info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
             info.RepeatColumns = 1;
             info.OuterTableImplied = true;
             table = new Table {
                 ID = this.ClientID
             };
             table.CopyBaseAttributes(this);
             table.Caption = this.Caption;
             table.CaptionAlign = this.CaptionAlign;
             table.ApplyStyle(controlStyle);
             table.RenderBeginTag(writer);
         }
         else
         {
             info.RepeatDirection = this.RepeatDirection;
             info.RepeatLayout = this.RepeatLayout;
             info.RepeatColumns = this.RepeatColumns;
             if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table)
             {
                 info.Caption = this.Caption;
                 info.CaptionAlign = this.CaptionAlign;
                 info.UseAccessibleHeader = this.UseAccessibleHeader;
             }
             else
             {
                 info.EnableLegacyRendering = base.EnableLegacyRendering;
             }
         }
         info.RenderRepeater(writer, this, controlStyle, this);
         if (table != null)
         {
             table.RenderEndTag(writer);
         }
     }
 }