在DataList的ItemCommand事件中:
protected void dataLst_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string sID = dataLst.DataKeys[e.Item.ItemIndex].ToString();//获取id
string sSql = "delete from PingLun where id=" + sID;
DB.ExecuteNonQuery(sSql);
dataLst.DataBind();
}
}
{
if (e.CommandName == "Delete")
{
string sID = dataLst.DataKeys[e.Item.ItemIndex].ToString();//获取id
string sSql = "delete from PingLun where id=" + sID;
DB.ExecuteNonQuery(sSql);
dataLst.DataBind();
}
}