using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace umbraco.uicontrols { public class TabView : System.Web.UI.WebControls.WebControl { private HtmlInputHidden tb = new HtmlInputHidden(); private ArrayList Tabs = new ArrayList(); private ArrayList Panels = new ArrayList(); private string status = ""; public ArrayList GetPanels() { return Panels; } public TabPage NewTabPage(string text) { Tabs.Add(text); TabPage tp = new TabPage(); tp.Width = this.Width; tp.ID = this.ID + "_tab0" + (Panels.Count + 1) + "layer"; Panels.Add(tp); this.Controls.Add(tp); return tp; } public string Status { get { return status; } set { status = value; } } private bool _autoResize = true; public bool AutoResize { get { return _autoResize; } set { _autoResize = value; } } private string ActiveTabId { get { if (this.Parent.Page.IsPostBack) { return this.Parent.Page.Request.Form[this.ClientID + "_activetab"]; } return this.ClientID + "_tab01"; } } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); SetupClientScript(); } private void SetupClientScript() { this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "TabviewCss", ""); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "TabviewJs", ""); string strTmp = ""; for (int i = 1; i <= Tabs.Count; i++) { if (i > 1) strTmp += ","; strTmp += "\"" + this.ClientID + "_tab0" + i + "\""; } this.Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "TabCollection", ""); this.Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "TabviewStartUp", ""); if (_autoResize) this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "TabviewEvents", ""); } protected override void Render(HtmlTextWriter writer) { writer.WriteLine("