CLabel: Custom label with tag parameter.
This commit is contained in:
45
Scrummer/Code/Controls/CLabel.cs
Normal file
45
Scrummer/Code/Controls/CLabel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user