Add ItemCommand Event on your datalist as given below.
<asp:datalist id="DataList1" runat="server" onitemcommand="DataList1_ItemCommand" xmlns:asp="#unknown">
<itemtemplate>
<asp:textbox id="txtcomment" runat="server" text=""></asp:textbox>
</itemtemplate>
</asp:datalist>
Then on item command event, you can get text of your textbox easily.
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox txtComments = (TextBox)e.Item.FindControl("txtcomment");
string Comments = txtComments.Text;
}
}
Accept Solution if it helps you.