Может быть, пользовательский контроль:
public partial class TabControl : System.Web.UI.UserControl
{
public List<TabObject> TabObjects { get; set; }
public override void RenderControl(HtmlTextWriter writer)
{
writer.Write("<div class=\"tabWrapper\">");
foreach (var item in TabObjects)
{
writer.Write("<div class=\"tab{0}\"><a href=\"{1}\">{2}</a></div>", (item.Selected) ? " tabSelected" : "", item.Link, item.Name);
}
writer.Write("<div class=\"clear\"></div>");
writer.Write("</div>");
base.RenderControl(writer);
}
}
Класс TabObject:
public class TabObject
{
public string Name { get; set; }
public string Link { get; set; }
public bool Selected { get; set; }
}
А на вашей странице:
UcTabControl.TabObjects = new List<TabObject>()
{
new TabObject(){
Link = "artworkHome.aspx",
Name = "Home",
Selected = true
},
new TabObject(){
Link = "#",
Name = "Create New",
Selected = false
},
new TabObject(){
Link = "#",
Name = "Help!",
Selected = false
},
};
Вывод будет:1010 *
<div class="tabWrapper">
<div class="tab tabSelected"><a href="artworkHome.aspx">Home</a></div>
<div class="tab"><a href="#">Create New</a></div>
<div class="tab"><a href="#">Help!</a></div>
<div class="clear"></div>
</div>