62,254
社区成员
发帖
与我相关
我的任务
分享
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="images/common/cartdelete.gif"
CommandArgument='<%#Eval("id") %>' CommandName="deletePro" />
protected void dlFavorite_ItemCommand(object source, DataListCommandEventArgs e)
{
//删除 操作
if (e.CommandName == "deletePro")
{
FavoriteManage.deleteFavorite(Convert.ToInt32(e.CommandArgument));//删除方法
BindFavoriteList(); //重新绑定
}
}
//删除
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string sqlstr = "delete from 表 where id='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
sqlcon = new SqlConnection(strCon);
sqlcom = new SqlCommand(sqlstr,sqlcon);
sqlcon.Open();
sqlcom.ExecuteNonQuery();
sqlcon.Close();
bind();
}