Esempio n. 1
0
	protected void Page_Load(object sender, EventArgs e)
	{
		//ExpressionHelper h = new ExpressionHelper ( "false`;`|name`:'abc'`,age`:123|``;" );
		//this.D ( h );

		//new ListItem ( );
		//this.Response.Write(this.jqueryUI.DraggableSetting.Options.Count);
		//this.Response.Write ( this.jqueryUI.DraggableSetting.Options[0].Value );
		zoyobar.shared.panzer.web.ScriptHelper s = new zoyobar.shared.panzer.web.ScriptHelper ( );

		s.Alert ( "'abc'" );
		//s.Build ( this );
		new System.Web.UI.WebControls.Button();
		//new System.Web.UI.Desi
	}
Esempio n. 2
0
		protected override void Render ( HtmlTextWriter writer )
		{

			if ( !this.Visible )
				return;

			if ( this.isFaceless ( ) )
				writer.Write ( "<span style=\"font-family: Verdana; background-color: #FFFFFF; font-size: 10pt;\"><strong>{0}:</strong> {1}</span>", "AjaxManager", this.ID );

			if ( this.DesignMode )
				return;

			ScriptHelper script = new ScriptHelper ( );

			//!+ The following code is similar with AutocompleteSetting.Recombine, WidgetSetting.Recombine

			foreach ( AjaxSetting ajax in this.ajaxs )
				if ( !string.IsNullOrEmpty ( ajax.ClientFunction ) )
				{
					string data;

					if ( string.IsNullOrEmpty ( ajax.MethodName ) )
						data = "data";
					else
						// According to the .NET version to determine the location of JSON
						if ( Environment.Version.Major <= 2 || ( Environment.Version.Major == 3 && Environment.Version.Minor == 0 ) )
							data = "data";
						else
							data = "data.d";

					if ( !string.IsNullOrEmpty ( ajax.Success ) )
						ajax.Success = ajax.Success.Replace ( "-:data", data );

					if ( !string.IsNullOrEmpty ( ajax.Complete ) )
						ajax.Complete = ajax.Complete.Replace ( "-:data", data );

					if ( !string.IsNullOrEmpty ( ajax.Error ) )
						ajax.Error = ajax.Error.Replace ( "-:data", data );

					JQuery jquery = JQueryUI.Create ( ajax );

					if(null != jquery)
						script.AppendCode ( "function " + ajax.ClientFunction + "(" + ajax.ClientParameter + ") {" + jquery.Code + "}" );

				}

			script.Build ( new ASPXScriptHolder ( this ), this.ClientID, ScriptBuildOption.Startup );
		}
Esempio n. 3
0
		/// <summary>
		/// 使页面上指定选择器的元素成为自定义插件.
		/// </summary>
		/// <param name="selector">用于指定页面上元素的选择器.</param>
		/// <param name="setting">自定义插件设置, 比如: TimerSetting, RepeaterSetting 等.</param>
		/// <param name="variableName">如果不为空, 则生成同名的 javascript 脚本变量.</param>
		public void Plusin ( string selector, PlusinSetting setting, string variableName = null )
		{

			if ( string.IsNullOrEmpty ( selector ) )
				throw new ArgumentNullException ( "selector", "选择器不能为空" );

			if ( null == setting )
				throw new ArgumentNullException ( "setting", "Plusin 设置不能为空" );

			string key = string.Format ( "__js{0}", setting.PlusinType );

			if ( !ScriptHelper.IsBuilt ( new RazorScriptHolder ( this.page ), key ) )
			{
				ScriptHelper script = new ScriptHelper ( );

				//foreach
				//script.AppendCode ( setting.GetDependentScripts ( ) );

				script.Build ( new RazorScriptHolder ( this.page ), key, ScriptBuildOption.Startup );
			}

			this.code += "$(function(){" + ( string.IsNullOrEmpty ( variableName ) ? string.Empty : ( "window['" + variableName + "'] = " ) ) + new JQueryUI ( selector ).Plusin ( setting ).Code + "});";
		}
Esempio n. 4
0
		/// <summary>
		/// 将目前所有的脚本输出.
		/// </summary>
		/// <param name="key">脚本块的关键字.</param>
		public void WriteScript ( string key = null )
		{

			if ( this.code == string.Empty )
				return;

			ScriptHelper script = new ScriptHelper ( );
			script.AppendCode ( this.code );
			script.Build ( new RazorScriptHolder ( this.page ), key );
			this.code = string.Empty;
		}