62,041
社区成员
发帖
与我相关
我的任务
分享
protected void LkDel_Click(object seder, EventArgs e)
{ //定义评论ID
string commentid = ((Button )seder).CommandArgument.ToString();
if (commentid != null)
{
sqlt.Operate("delete dbo.space_MyComments where commentid=" + commentid + " "); sqlt.ConClose();
}
}
<asp:button id="button1" CommandArgument='<%#Eval("绑定主键")' runat="server" text="修改" Onclick="button1_Click">
在button1_Click中
string id = ((Button)sender).CommandArgument;
获得主键。
就可以判断当前行了!