Hi:
To test, you can first write code below in the same project of your web site:
public class RepeaterTemplate : ITemplate
{
public RepeaterTemplate()
{
}
//A variable to hold the type of ListItemType.
ListItemType _templateType;
//Constructor where we define the template type and column name.
public RepeaterTemplate(ListItemType type)
{
//Stores the template type.
_templateType = type;
}
void ITemplate.InstantiateIn(System.Web.UI.Control container)
{
switch (_templateType)
{
case ListItemType.Item:
Literal l = new Literal();
l.Text = @"<h2><a id='title' href='\wa\home\details.aspx' runat='server'>Hello</a></h2>
<div id='summary' runat='server'>It's invisible if here's no text so I added it</div>";
container.Controls.Add(l);
break;
}
}
}
public class CustomRepeater:Repeater
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.ItemTemplate = new RepeaterTemplate(ListItemType.Item);
}
}
protected void Page_Load(object sender, EventArgs e)
{
CustomRepeater r = new CustomRepeater();
this.form1.Controls.Add(r);
r.DataSourceID = "SqlDataSource1";
r.DataBind();
}
If code above works, you can put these code(bold one) into a ClassLibrary project and build a .dll. Then in each project you can simply add a reference from this dll file and use it as mentioned above.
If it doesn't work, please inform us.
Regards