public void RaisePostBackEvent(string eventArgument) { if (string.IsNullOrEmpty(eventArgument)) { return; } string[] parts = eventArgument.Split(';'); switch (parts[0]) { case "select": if (null != this.SelectSync) { TabsEventArgs e = new TabsEventArgs(StringConvert.ToObject <int> (parts[1])); this.onSelect(e); this.SelectSync(this, e); } break; } }
/* * protected override void Render ( HtmlTextWriter writer ) * { * * if ( !this.DesignMode ) * { * // this.widgetSetting.Type = this.type; * * // this.widgetSetting.TabsSetting.SetEditHelper ( this.editHelper ); * * this.widgetSetting.AjaxSettings.Clear ( ); * * if ( this.selectAjax.Url != string.Empty ) * { * this.selectAjax.WidgetEventType = EventType.tabsselect; * this.widgetSetting.AjaxSettings.Add ( this.selectAjax ); * } * * * if ( null != this.SelectSync ) * this.Select = "function(event, ui){" + this.Page.ClientScript.GetPostBackEventReference ( this, "select;[%':ui.index%]" ) + "}"; * * } * else if ( this.selector == string.Empty ) * switch ( this.widgetSetting.Type ) * { * case WidgetType.tabs: * string style = string.Empty; * * if ( this.Width != Unit.Empty ) * style += string.Format ( "width:{0};", this.Width ); * * if ( this.Height != Unit.Empty ) * style += string.Format ( "height:{0};", this.Height ); * * string html = string.Empty; * * if ( this.html.Controls.Count != 0 ) * try * { * // HACK: 这里也可以使用 panzer 的 Xml 类. * html = ( this.html.Controls[0] as System.Web.UI.LiteralControl ).Text.Replace ( "__designer:", string.Empty ); * * XmlDocument xml = new XmlDocument ( ); * xml.LoadXml ( string.Format ( "<html>{0}</html>", html ) ); * * XmlNode titleNode = xml.FirstChild.FirstChild; * * titleNode.Attributes.Append ( xml.CreateAttribute ( "class" ) ).Value = "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"; * * for ( int index = 0; index < titleNode.ChildNodes.Count; index++ ) * titleNode.ChildNodes[index].Attributes.Append ( xml.CreateAttribute ( "class" ) ).Value = "ui-state-default ui-corner-top" + ( index == this.Selected ? " ui-tabs-selected ui-state-active" : string.Empty ); * * for ( int index = 1; index < xml.FirstChild.ChildNodes.Count; index++ ) * xml.FirstChild.ChildNodes[index].Attributes.Append ( xml.CreateAttribute ( "class" ) ).Value = "ui-tabs-panel ui-widget-content ui-corner-bottom" + ( index - 1 == this.Selected ? string.Empty : " ui-tabs-hide" ); * * html = xml.FirstChild.InnerXml; * } * catch ( Exception err ) { html = err.Message; } * * writer.Write ( * "<{6} id=\"{0}\" class=\"{3}ui-tabs ui-widget ui-widget-content ui-corner-all{2}\" style=\"{4}\" title=\"{5}\">{1}</{6}>", * this.ClientID, * html, * this.Disabled ? " ui-tabs-disabled ui-state-disabled" : string.Empty, * string.IsNullOrEmpty ( this.CssClass ) ? string.Empty : this.CssClass + " ", * style, * this.ToolTip, * this.elementType.ToString ( ).ToLower ( ) * ); * return; * } * * base.Render ( writer ); * } */ private void onSelect(TabsEventArgs e) { this.Selected = e.Index; }