前台
<asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" CommandArgument='<%# Eval("UserId") %>'>【通过】</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click" CommandArgument='<%# Eval("UserId") %>'>【拒绝】</asp:LinkButton> </ItemTemplate> <ItemStyle Width="140px"></ItemStyle> </asp:TemplateField>
后台
protected void LinkButton1_Click(object sender, EventArgs e) { string id = ((LinkButton)sender).CommandArgument.ToString(); string update = "update tb_UserExtends set sbpcStatus='通过'where UserId="+id; db.db.ExecuteSql(update); }