﻿// Decompiled with JetBrains decompiler
// Type: System.Web.UI.WebControls.LabelLiteral
// Assembly: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7E68A73E-4066-4F24-AB0A-F147209F50EC
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.dll

using System.Runtime;
using System.Web.UI;

namespace System.Web.UI.WebControls
{
  internal sealed class LabelLiteral : Literal
  {
    internal Control _for;
    internal bool _renderAsLabel;

    internal bool RenderAsLabel
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this._renderAsLabel;
      }
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] set
      {
        this._renderAsLabel = value;
      }
    }

    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    internal LabelLiteral(Control forControl)
    {
      this._for = forControl;
    }

    protected internal override void Render(HtmlTextWriter writer)
    {
      if (this.RenderAsLabel)
      {
        writer.Write("<asp:label runat=\"server\" AssociatedControlID=\"");
        writer.Write(this._for.ID);
        writer.Write("\" ID=\"");
        writer.Write(this._for.ID);
        writer.Write("Label\">");
        writer.Write(this.Text);
        writer.Write("</asp:label>");
      }
      else
      {
        writer.AddAttribute(HtmlTextWriterAttribute.For, this._for.ClientID);
        writer.RenderBeginTag(HtmlTextWriterTag.Label);
        base.Render(writer);
        writer.RenderEndTag();
      }
    }
  }
}
