Hi Jack,
I'm not really clear on what your problem is or what's not working for you.
Perhaps you could elaborate? It the meantime, the code below (ASP.NET 2.0)
inserts buttons into a datalist template.
Let us know?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Function CreateDataSource() As Data.DataTable
Dim dt As New Data.DataTable
Dim dr As Data.DataRow
dt.Columns.Add(New Data.DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New Data.DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New Data.DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New Data.DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 5
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function
Protected Sub Page_Load _
(ByVal sender As Object, ByVal e As System.EventArgs)
If Not IsPostBack Then
DataList1.DataSource = CreateDataSource()
DataList1.DataBind()
End If
End Sub
Sub btncmd(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.CommandEventArgs)
Label1.Text = e.CommandName
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:datalist id="DataList1" runat="server">
<itemtemplate>
<asp:button id="Button1" runat="server" commandname="Add"
oncommand="btncmd" text="Button" />
<asp:button id="Button2" runat="server" commandname="Edit"
oncommand="btncmd" text="Button" />
<asp:button id="Button3" runat="server" commandname="Delete"
oncommand="btncmd" text="Button" /><br />
<%#DataBinder.Eval(Container, "DataItem.StringValue")%>
</itemtemplate>
</asp:datalist>
<asp:label id="Label1" runat="server" text=""></asp:label></div>
</form>
</body>
</html>