The following code example demonstrates how to use the LoadTemplate method to add a user control as an alternating item to a DataList Web server control named DataList1. The user control implements the ITemplate interface and is contained in a file named Newtemplate.ascx.
Sub Page_Load(sender As [Object], e As EventArgs)
IfNot IsPostBack Then
DataList1.AlternatingItemTemplate = LoadTemplate("newtemplate.ascx")
DataList1.DataSource = CreateDataSource()
DataList1.DataBind()
EndIfEndSub'Page_Load