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


C# HtmlTextWriter.GetType方法代码示例

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


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

示例1: Render

		protected override void Render(HtmlTextWriter writer) {
			if(this.FormControl != null && this.XhtmlStrictRendering && writer.GetType() == typeof(HtmlTextWriter) && this.AdapterEnabled) {
				var w = new StrictHtmlTextWriter(writer);
				base.Render(w);
			} else {
				base.Render(writer);
			}
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:8,代码来源:HtmlFormAdapter.cs

示例2: Render

    /// <internalonly/>
    /// <devdoc>
    ///    <para>[To be supplied.]</para>
    /// </devdoc>
    protected internal override void Render(HtmlTextWriter output) {
        CacheDependency sqlCacheDep = null;

        // If the output is cached, use it and do nothing else
        if (_outputString != null) {
            output.Write(_outputString);
            RegisterValidationEvents();
            return;
        }

        // If caching was turned off, just render the control
        if (_cachingDisabled || !RuntimeConfig.GetAppConfig().OutputCache.EnableFragmentCache) {
            _cachedCtrl.RenderControl(output);
            return;
        }

        // Create SQL cache dependency before we render the page
        if (_sqlDependency != null) {
            sqlCacheDep = SqlCacheDependency.CreateOutputCacheDependency(_sqlDependency);
        }

        _cacheEntry.CssStyleString = GetCssStyleRenderString(output.GetType());

        // Create a new HtmlTextWriter, with the same type as the current one (see ASURT 118922)
        StringWriter tmpWriter = new StringWriter();
        HtmlTextWriter tmpHtmlWriter = Page.CreateHtmlTextWriterFromType(tmpWriter, output.GetType());
        CacheDependency cacheDep;
        TextWriter savedWriter = Context.Response.SwitchWriter(tmpWriter);

        try {
            // Make sure the Page knows about us while the control's OnPreRender is called
            Page.PushCachingControl(this);
            _cachedCtrl.RenderControl(tmpHtmlWriter);
            Page.PopCachingControl();
        }
        finally {
            Context.Response.SwitchWriter(savedWriter);
        }

        _cacheEntry.OutputString = tmpWriter.ToString();

        // Send the output to the response
        output.Write(_cacheEntry.OutputString);

        // Cache the output

        cacheDep = _cacheDependency;

        if (sqlCacheDep != null) {
            if (cacheDep == null) {
                cacheDep = sqlCacheDep;
            }
            else {
                AggregateCacheDependency aggr = new AggregateCacheDependency();

                aggr.Add(cacheDep);
                aggr.Add(sqlCacheDep);
                cacheDep = aggr;
            }
        }

        ControlCachedVary cachedVary = null;
        string realItemCacheKey;
        // If there are no varies, use the non-varying key
        if (_varyByParamsCollection == null && _varyByControlsCollection == null && _varyByCustom == null) {
            realItemCacheKey = _cacheKey;
        }
        else {
            string[] varyByParams = null;
            if (_varyByParamsCollection != null)
                varyByParams = _varyByParamsCollection.GetParams();

            cachedVary = new ControlCachedVary(varyByParams, _varyByControlsCollection, _varyByCustom);

            HashCodeCombiner combinedHashCode = new HashCodeCombiner(_nonVaryHashCode);
            realItemCacheKey = ComputeVaryCacheKey(combinedHashCode, cachedVary);
        }

        // Compute the correct expiration, sliding or absolute
        DateTime utcExpirationTime;
        TimeSpan slidingExpiration;
        if (_useSlidingExpiration) {
            utcExpirationTime = Cache.NoAbsoluteExpiration;
            slidingExpiration = _utcExpirationTime - DateTime.UtcNow;
        }
        else {
            utcExpirationTime = _utcExpirationTime;
            slidingExpiration = Cache.NoSlidingExpiration;
        }
        
        try {
            OutputCache.InsertFragment(_cacheKey, cachedVary,
                                       realItemCacheKey, _cacheEntry,
                                       cacheDep /*dependencies*/,
                                       utcExpirationTime, slidingExpiration,
                                       _provider);
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:PartialCachingControl.cs

示例3: Render

        protected override void Render(HtmlTextWriter writer)
        {
            if (!SiteUtils.UrlWasReWritten())
            {
                try
                {
                    // form action can't be empty string
                    EnsureFormAction();
                }
                catch (MissingMethodException)
                {
                    //this method was introduced in .NET 3.5 SP1
                }

                base.Render(writer);
                return;
            }

            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
            *
            * Custom HtmlTextWriter to fix Form Action
            * Based on Jesse Ezell's "Fixing Microsoft's Bugs: URL Rewriting"
            * http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx
            *
            * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
            // this removes the action attribute from the form
            // so that it posts back correctly when using url re-writing

            //string rawUrl = Request.RawUrl;
            string action = Request.RawUrl;
            //if (Request.RawUrl.IndexOf(".aspx") > -1)
            //{
            //    action = Path.GetFileName(Request.RawUrl.Substring(0, Request.RawUrl.IndexOf(".aspx") + 5));
            //}
            //else
            //{
            //    action = Path.GetFileName(Request.RawUrl);
            //}

            // we need to append the query string to the form action
            // otherwise the params won't be available when the form posts back
            // example if editing an event ~/EventCalendarEdit.aspx??mid=4&pageid=3
            // if the form action is merely "EventCalendarEdit.aspx" we won't have the
            // mid and pageid params on postback. querystring is only available in get requests
            // unless the form action includes it, then its also available in post requests

            if (
                (appendQueryStringToAction)
                && (action.IndexOf("?") == -1)
                && (Request.QueryString.Count > 0)
                )
            {
                action += "?" + Request.QueryString.ToString();
            }

            if (action.Length == 0) { action = "/"; }

            if (writer.GetType() == typeof(HtmlTextWriter))
            {
                writer = new MojoHtmlTextWriter(writer, action);
            }
            else if (writer.GetType() == typeof(Html32TextWriter))
            {
                writer = new MojoHtml32TextWriter(writer, action);
            }

            base.Render(writer);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:68,代码来源:mojoBasePage.cs

示例4: Render

        protected override void Render(HtmlTextWriter writer)
        {
            // Render the content of this control to a string
            StringWriter sw = new StringWriter();
            System.Reflection.ConstructorInfo constructor
                = writer.GetType().GetConstructor(new Type[] { sw.GetType() });
            HtmlTextWriter htw = constructor.Invoke(new object[] {sw}) as HtmlTextWriter;
            base.RenderChildren(htw);
            htw.Close();

            // Filter the string and write the result
            Filter f = new Filter();
            f.ClientSideFilterName = ClientSideFilterName;
            f.SupportNoScriptTables = SupportNoScriptTables;
            f.MaxComplexity = MaxComplexity;
            f.TrustedImageUrlRegex = TrustedImageUrlRegex;
            f.SpamFreeLinkUrlRegex = SpamFreeLinkUrlRegex;
            writer.Write(f.FilterUntrusted(sw.ToString()));
        }
开发者ID:joeaudette,项目名称:mojoportal,代码行数:19,代码来源:UntrustedContent.cs

示例5: Render

        protected override void Render(HtmlTextWriter writer)
        {
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
            *
            * Custom HtmlTextWriter to fix Form Action
            * Based on Jesse Ezell's "Fixing Microsoft's Bugs: URL Rewriting"
            * http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx
            *
            * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
            // this removes the action attribute from the form
            // so that it posts back correctly when using url re-writing

            string action = Path.GetFileName(Request.RawUrl);
            if (action.IndexOf("?") == -1 && Request.QueryString.Count > 0)
            {
                action += "?" + Request.QueryString.ToString();
            }
            if (writer.GetType() == typeof(HtmlTextWriter))
            {
                writer = new MojoHtmlTextWriter(writer, action);
            }
            else if (writer.GetType() == typeof(Html32TextWriter))
            {
                writer = new MojoHtml32TextWriter(writer, action);
            }

            base.Render(writer);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:28,代码来源:HelpEdit.aspx.cs

示例6: Render

		protected override void Render(HtmlTextWriter writer)
		{
			globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
			DateTime visDate   = GetEffectiveVisibleDate();
			DateTime firstDate = GetFirstCalendarDay(visDate);

			bool isEnabled;
			bool isHtmlTextWriter;
			//FIXME: when Control.Site works, reactivate this
			//if (Page == null || Site == null) {
			//	isEnabled = false;
			//	isHtmlTextWriter = false;
			//} else {
				isEnabled = Enabled;
				isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
			//}
			defaultTextColor = ForeColor;
			if(defaultTextColor == Color.Empty)
				defaultTextColor = Color.Black;

			Table calTable = new Table ();
			calTable.ID = ID;
			calTable.CopyBaseAttributes(this);
			if(ControlStyleCreated)
				calTable.ApplyStyle(ControlStyle);
			calTable.Width = Width;
			calTable.Height = Height;
			calTable.CellSpacing = CellSpacing;
			calTable.CellPadding = CellPadding;

			if (ControlStyleCreated &&
			    ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
			    BorderWidth != Unit.Empty)
				calTable.BorderWidth = BorderWidth;
			else
				calTable.BorderWidth = Unit.Pixel(1);

			if (ShowGridLines)
				calTable.GridLines = GridLines.Both;
			else
				calTable.GridLines = GridLines.None;
				
#if NET_2_0
			calTable.Caption = Caption;
			calTable.CaptionAlign = CaptionAlign;
#endif

			calTable.RenderBeginTag (writer);

			if (ShowTitle)
				RenderTitle (writer, visDate, SelectionMode, isEnabled);

			if (ShowDayHeader)
				RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);

			RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);

			calTable.RenderEndTag(writer);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:59,代码来源:Calendar.cs

示例7: Render

 protected internal override void Render(HtmlTextWriter output)
 {
     CacheDependency dependency = null;
     if (this._outputString != null)
     {
         output.Write(this._outputString);
         this.RegisterValidationEvents();
     }
     else if (this._cachingDisabled || !RuntimeConfig.GetAppConfig().OutputCache.EnableFragmentCache)
     {
         this._cachedCtrl.RenderControl(output);
     }
     else
     {
         string str;
         DateTime noAbsoluteExpiration;
         TimeSpan noSlidingExpiration;
         if (this._sqlDependency != null)
         {
             dependency = SqlCacheDependency.CreateOutputCacheDependency(this._sqlDependency);
         }
         this._cacheEntry.CssStyleString = this.GetCssStyleRenderString(output.GetType());
         StringWriter tw = new StringWriter();
         HtmlTextWriter writer = Page.CreateHtmlTextWriterFromType(tw, output.GetType());
         TextWriter writer3 = this.Context.Response.SwitchWriter(tw);
         try
         {
             this.Page.PushCachingControl(this);
             this._cachedCtrl.RenderControl(writer);
             this.Page.PopCachingControl();
         }
         finally
         {
             this.Context.Response.SwitchWriter(writer3);
         }
         this._cacheEntry.OutputString = tw.ToString();
         output.Write(this._cacheEntry.OutputString);
         CacheDependency dependencies = this._cacheDependency;
         if (dependency != null)
         {
             if (dependencies == null)
             {
                 dependencies = dependency;
             }
             else
             {
                 AggregateCacheDependency dependency3 = new AggregateCacheDependency();
                 dependency3.Add(new CacheDependency[] { dependencies });
                 dependency3.Add(new CacheDependency[] { dependency });
                 dependencies = dependency3;
             }
         }
         ControlCachedVary cachedVary = null;
         if (((this._varyByParamsCollection == null) && (this._varyByControlsCollection == null)) && (this._varyByCustom == null))
         {
             str = this._cacheKey;
         }
         else
         {
             string[] varyByParams = null;
             if (this._varyByParamsCollection != null)
             {
                 varyByParams = this._varyByParamsCollection.GetParams();
             }
             cachedVary = new ControlCachedVary(varyByParams, this._varyByControlsCollection, this._varyByCustom);
             HashCodeCombiner combinedHashCode = new HashCodeCombiner(this._nonVaryHashCode);
             str = this.ComputeVaryCacheKey(combinedHashCode, cachedVary);
         }
         if (this._useSlidingExpiration)
         {
             noAbsoluteExpiration = Cache.NoAbsoluteExpiration;
             noSlidingExpiration = (TimeSpan) (this._utcExpirationTime - DateTime.UtcNow);
         }
         else
         {
             noAbsoluteExpiration = this._utcExpirationTime;
             noSlidingExpiration = Cache.NoSlidingExpiration;
         }
         try
         {
             OutputCache.InsertFragment(this._cacheKey, cachedVary, str, this._cacheEntry, dependencies, noAbsoluteExpiration, noSlidingExpiration, this._provider);
         }
         catch
         {
             if (dependencies != null)
             {
                 dependencies.Dispose();
             }
             throw;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:92,代码来源:BasePartialCachingControl.cs


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