前台代码: <asp:Repeater ID="Message" runat="server" onitemdatabound="Message_ItemDataBound"> <HeaderTemplate> <table id="idtable" > <tr class="repeater"> <th>分组类型</th> <th>分组名称</th> <th>操作</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:Label ID="g_type" runat="server" Text='<%#Eval("g_type") %>' Visible="false"></asp:Label> <asp:Label ID="g_type1" runat="server" Text="常用邮箱通讯录"></asp:Label> </td> <td><asp:Label ID="g_name" runat="server" Text='<%#Eval("g_name") %>'></asp:Label></td> <td><asp:LinkButton ID="delete" runat="server" Text="删除" CommandArgument='<%#Eval("g_id") %>' OnClientClick="return confirm('确认删除?')" OnClick="delete_Click"></asp:LinkButton> <asp:Label ID="share" runat="server" Text='<%#Eval("share") %>' Visible="false"></asp:Label> <asp:LinkButton ID="share1" runat="server" Text="共享" CommandArgument='<%#Eval("g_id") %>' OnClick="share_Click"></asp:LinkButton> </td> </tr> </ItemTemplate> <FooterTemplate></table></FooterTemplate> </asp:Repeater> 后台代码: protected void delete_Click(object sender, EventArgs e) { LinkButton delete = (LinkButton)sender; string id = delete.CommandArgument.Trim(); string sql_delete = "delete from favorite_group where g_id=@id"; SqlParameter[] param = { new SqlParameter("@id",id) }; sqlhelper.ExecuteNonSqlParams(sql_delete, "teacher", param); DataBind(); }