日期:2014-05-17 浏览次数:20626 次
<asp:TemplateField HeaderText="删除用户"> <ItemTemplate> <asp:Button ID="btnDelete" runat="server" Text="删除" OnClientClick="return confirm('确定要删除此用户?')" OnClick="btnDelete_Click" /> </ItemTemplate> </asp:TemplateField>
string strID = GridLog.DataKeys[e.RowIndex].Value.ToString();//strID就是该行的ID string strSQL = "Delete from table " + " WHERE id = " + strID; //执行删除 ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('删除成功!');</script>"); DataBind();
------解决方案--------------------
http://dotnet.aspx.cc/file/Add-Delete-Update-Edit-Data-With-Paging-in-GridView.aspx
------解决方案--------------------
看我的一篇博客吧,其中的增删改查都有
http://blog.csdn.net/keymo_
其中的“学习笔记(4)”。
------解决方案--------------------
[code=C#][/code]
<asp:TemplateField HeaderText="操作" ItemStyle-CssClass="style1"> <ItemTemplate> <img src="../JcasImg/Delete.png" alt="" style="width: 15px; height: 15px"/> <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return confirm('确定要删除吗?')" CommandName="delete" Font-Overline="false">删除</asp:LinkButton> </ItemTemplate> </asp:TemplateField>
------解决方案--------------------
<asp:TemplateField ItemStyle-Width="30"> <ItemTemplate> <asp:LinkButton ID="delete" CommandName="delete" runat="server" CausesValidation="false" Text="删除" OnClientClick="return confirm('你确认要删除吗?')" > </asp:LinkButton> </ItemTemplate> </asp:TemplateField>