CLabel: Custom label with tag parameter.

This commit is contained in:
2015-05-24 04:47:27 +02:00
parent b69ba0540a
commit 0517f70f44
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Scrummer.Code.Controls
{
public class CLabel : Label
{
#region Declarations
private string _tagName = "span";
#endregion
#region Properties
public string Tag
{
get { return _tagName; }
set { _tagName = value; }
}
#endregion
#region Life cycle
public override void RenderBeginTag(HtmlTextWriter writer)
{
if (string.IsNullOrEmpty(_tagName) == false)
{
this.AddAttributesToRender(writer);
writer.RenderBeginTag(_tagName);
}
else
{
base.RenderBeginTag(writer);
}
}
#endregion
}
}