当前位置: 首页>>代码示例>>C#>>正文


C# HtmlLink.Dispose方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlLink.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlLink.Dispose方法的具体用法?C# HtmlLink.Dispose怎么用?C# HtmlLink.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlControls.HtmlLink的用法示例。


在下文中一共展示了HtmlLink.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPreRender

		/// <summary>
		/// Prepares to render the control.
		/// </summary>
		/// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
		protected override void OnPreRender(EventArgs e) {
			base.OnPreRender(e);

			if (!this.Visible) {
				return;
			}

			if (this.DownloadYahooUILibrary) {
				// Although we'll add the <script> tag to download the YAHOO component,
				// a download failure may have occurred, so protect ourselves from a 
				// script error using an if (YAHOO) block.  But apparently at least in IE
				// that's not even enough, so we use a try/catch.
				string yuiLoadScript = @"try { if (YAHOO) {
	var loader = new YAHOO.util.YUILoader({
		require: ['button', 'menu'],
		loadOptional: false,
		combine: true
	});

	loader.insert();
} } catch (e) { }";
				this.Page.ClientScript.RegisterClientScriptInclude("yuiloader", this.Page.Request.Url.IsTransportSecure() ? YuiLoaderHttps : YuiLoaderHttp);
				this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "requiredYuiComponents", yuiLoadScript, true);
			}

			var css = new HtmlLink();
			try {
				css.Href = this.Page.ClientScript.GetWebResourceUrl(typeof(OpenIdAjaxTextBox), EmbeddedStylesheetResourceName);
				css.Attributes["rel"] = "stylesheet";
				css.Attributes["type"] = "text/css";
				ErrorUtilities.VerifyHost(this.Page.Header != null, OpenIdStrings.HeadTagMustIncludeRunatServer);
				this.Page.Header.Controls.AddAt(0, css); // insert at top so host page can override
			} catch {
				css.Dispose();
				throw;
			}

			this.PrepareClientJavascript();

			// If an Identifier is preset on this control, preload discovery on that identifier,
			// but only if we're not already persisting an authentication result since that would
			// be redundant.
			if (this.Identifier != null && this.AuthenticationResponse == null) {
				this.PreloadDiscovery(this.Identifier);
			}
		}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:50,代码来源:OpenIdAjaxTextBox.cs

示例2: OnPreRender

		/// <summary>
		/// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
		/// </summary>
		/// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
		protected override void OnPreRender(EventArgs e) {
			base.OnPreRender(e);

			this.EnsureValidButtons();

			var css = new HtmlLink();
			try {
				css.Href = this.Page.ClientScript.GetWebResourceUrl(typeof(OpenIdSelector), EmbeddedStylesheetResourceName);
				css.Attributes["rel"] = "stylesheet";
				css.Attributes["type"] = "text/css";
				ErrorUtilities.VerifyHost(this.Page.Header != null, OpenIdStrings.HeadTagMustIncludeRunatServer);
				this.Page.Header.Controls.AddAt(0, css); // insert at top so host page can override
			} catch {
				css.Dispose();
				throw;
			}

			// Import the .js file where most of the code is.
			this.Page.ClientScript.RegisterClientScriptResource(typeof(OpenIdSelector), EmbeddedScriptResourceName);

			// Provide javascript with a way to post the login assertion.
			const string PostLoginAssertionMethodName = "postLoginAssertion";
			const string PositiveAssertionParameterName = "positiveAssertion";
			const string ScriptFormat = @"window.{2} = function({0}) {{
	$('#{3}')[0].setAttribute('value', {0});
	{1};
}};";
			string script = string.Format(
				CultureInfo.InvariantCulture,
				ScriptFormat,
				PositiveAssertionParameterName,
				this.Page.ClientScript.GetPostBackEventReference(this, null, false),
				PostLoginAssertionMethodName,
				this.positiveAssertionField.ClientID);
			this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Postback", script, true);

			this.Page.RegisterAsyncTask(new PageAsyncTask(async ct => {
				await this.PreloadDiscoveryAsync(
					this.Buttons.OfType<SelectorProviderButton>().Select(op => op.OPIdentifier).Where(id => id != null),
					ct);
			}));
			this.textBox.Visible = this.OpenIdTextBoxVisible;
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:47,代码来源:OpenIdSelector.cs


注:本文中的System.Web.UI.HtmlControls.HtmlLink.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。