I use a repeater Control
to display all the comments from Datatable
:
COMMENT(id,content,time);
In repeater I insert a button Delete
to Delete that correlative comment
I wonder if I can add an variable "string id
" in ButtonDelete_Click()
like:
protected void ButtonDelete_Click(object sender, EventArgs e, string id)
{
int idcm = Convert.ToInt32(id);
string sql = "delete from COMMENT where ID=" + idcm;
l.EXECUTEQUERYSQL(sql);
ErrorTrap("DONE");//alert deleted sucessfully
}
And in aspx page:
<Repeater...>
<asp:Button ID="ButtonDelete" runat="server" Text="Delete comment"
OnClick="ButtonDelete_Click(<%#Eval("MA_COMMENT") %>)"/>
....
</Repeater>
But when I build this page, an error ocur: The server tag is not well formed.
at line:
<asp:Button ID="ButtonDelete" runat="server" Text="Delete comment"
OnClick="ButtonDelete_Click(<%#Eval("MA_COMMENT") %>)"/>
It is the first time I use Repeater Control, so I really dont know how is the right syntax? And I wonder if I can add more variales in ButtonDelete_Click Event or not???
Help!