<asp:TemplateField HeaderText="删除">
          <ItemTemplate>
                <asp:LinkButton runat="server" ID="lnkDelete" OnClick="btnDocDelete_Click" OnClientClick="return confirm('您真的要删除此行吗?')"
                          Width="30px">删除</asp:LinkButton>
                 </ItemTemplate>
</asp:TemplateField>

  protected void btnDocDelete_Click(object sender, EventArgs e)
    {
        GridViewRow row = (sender as LinkButton).NamingContainer as GridViewRow;
        int docID = Convert.ToInt32(this.gView.DataKeys[row.RowIndex].Value);
        this.m_DocGateway.DeleteDoc(docID);
        string strPath = this.m_strPath + "\\" + this.gView.DataKeys[row.RowIndex]["Title"].ToString();
        File.Delete(strPath);

        this.BindData(0);
    }

相关文章:

  • 2021-11-22
  • 2022-02-06
  • 2021-05-18
  • 2022-02-17
  • 2021-10-12
  • 2022-12-23
  • 2022-02-05
  • 2021-10-30
猜你喜欢
  • 2021-11-16
  • 2022-01-26
  • 2022-12-23
  • 2021-08-17
  • 2021-08-28
  • 2021-06-26
相关资源
相似解决方案