コード例 #1
0
        public override void RenderControl(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.DesignMode)
            {
                base.RenderControl(writer);
            }
            else
            {
                Panel outerDiv = new Panel();
                outerDiv.ID       = ClientID;
                outerDiv.CssClass = this.CssClass;

                outerDiv.ApplyStyle(ControlStyle);
                if (tabs == null)
                {
                    tabs = CreateTabs();
                    tabs.CreateStyle(Page, "#" + ClientID + " ul." + ClientID);
                }
                outerDiv.Controls.Add(tabs);

                /*
                 * Dim lClear As New Literal
                 * lClear.Text = "<div style=""clear:both""></div>"
                 * outerDiv.Controls.Add(lClear)
                 */


                Panel innerDiv = new Panel();
                innerDiv.CssClass = "container";

                TabView view = GetCurrentView();
                if (view != null)
                {
                    innerDiv.ApplyStyle(view.ControlStyle);
                    innerDiv.Style["border-top"] = "0 !important";
                    if (view.ControlStyle.BorderStyle == BorderStyle.None || view.ControlStyle.BorderStyle == BorderStyle.NotSet)
                    {
                        innerDiv.BorderStyle = TabBorderStyle;
                        innerDiv.BorderWidth = TabBorderWidth;
                        innerDiv.BorderColor = TabBorderColor;
                    }

                    //padding: top right bottom left
                    if (!ContainerPaddingLeft.IsEmpty)
                    {
                        innerDiv.Style["padding-left"] = ContainerPaddingLeft.ToString();
                    }
                    if (!ContainerPaddingRight.IsEmpty)
                    {
                        innerDiv.Style["padding-right"] = ContainerPaddingLeft.ToString();
                    }
                    if (!ContainerPaddingTop.IsEmpty)
                    {
                        innerDiv.Style["padding-top"] = ContainerPaddingLeft.ToString();
                    }
                    if (!ContainerPaddingBottom.IsEmpty)
                    {
                        innerDiv.Style["padding-bottom"] = ContainerPaddingLeft.ToString();
                    }
                }

                innerDiv.ScrollBars = ScrollBars.Auto;
                if (!outerDiv.Height.IsEmpty)
                {
                    innerDiv.Height = new Unit(outerDiv.Height.Value - tabs.RealHeight.Value, UnitType.Pixel);
                    outerDiv.Height = Unit.Empty;
                }

                /*
                 * If outerDiv.Height.IsEmpty Then
                 *  If innerDiv.Height.IsEmpty Then
                 *      innerDiv.Height = New Unit(200 - tabs.RealHeight.Value, UnitType.Pixel)
                 *  End If
                 * Else
                 *  innerDiv.Height = New Unit(outerDiv.Height.Value - tabs.RealHeight.Value, UnitType.Pixel)
                 * End If
                 */


                Literal l = new Literal();
                l.Text = "{0}";

                innerDiv.Controls.Add(l);

                outerDiv.Controls.Add(innerDiv);


                System.IO.StringWriter htmlSW = new System.IO.StringWriter();
                HtmlTextWriter         html32 = new HtmlTextWriter(htmlSW);
                outerDiv.RenderControl(html32);
                string html = htmlSW.ToString();

                writer.WriteLine(html.Substring(0, html.IndexOf("{0}")));
                base.RenderControl(writer);
                writer.WriteLine(html.Substring(html.IndexOf("{0}") + 3));
            }
        }
コード例 #2
0
 protected override void OnPreRender(System.EventArgs e)
 {
     base.OnPreRender(e);
     tabs = CreateTabs();
     tabs.CreateStyle(Page, "#" + ClientID + " ul." + ClientID);
 }