zoukankan      html  css  js  c++  java
  • DataList删除操作

    <asp:DataList ID="fileList" runat="server" RepeatColumns="1" RepeatDirection="Horizontal"
    CssClass="body" DataKeyField="ContentID" OnItemCommand="fileList_ItemCommand">
    <ItemTemplate>
    <table border="0" cellpadding="0" cellspacing="0" style=" 760px">
      <tr>
        <td style=" 760px; text-align: center">
          <a href='<%# SetFileUrl(DataBinder.Eval(Container.DataItem, "ContentName"))%>'>
            <%# SetFileName(DataBinder.Eval(Container.DataItem, "ContentName"))%></a>
        </td>
      </tr>
      <tr>
        <td style=" 760px; text-align: center">
          <iframe id="fileview" name="fileview" width="760px" height="600px" src='<%# GetFilePath(DataBinder.Eval(Container.DataItem,                       "ContentName"),DataBinder.Eval(Container.DataItem, "FileType"))%>'>
          </iframe>
        </td>
      </tr>
      <tr>
        <td style=" 760px; text-align: center; height: 18px;">
          <asp:ImageButton ID="imgBtnDelete" runat="server" CommandName="del" ImageUrl="~/images/btn_delete.png"
             OnClientClick="return ConfirmDelete()" />
        </td>
      </tr>
    </table>
    </ItemTemplate>
    </asp:DataList>

    protected void fileList_ItemCommand(object source, DataListCommandEventArgs e)
    {
      int menuId;
      string contentName = string.Empty;
      bool result = true;
      if (e.CommandName == "del")
      {
        int id = Int32.Parse(fileList.DataKeys[e.Item.ItemIndex].ToString());
        result = bllConent.DeleteItem(id, out menuId, out contentName);

        if (result)
        {
          result = AndroidKit.Common.ComHelper.DeleteFile(contentName);
          BindData(menuId);
          Response.Write("<script>alert("删除成功")</script>");
        }
      }
    }

  • 相关阅读:
    HTML if条件注释解读
    Springboot整合logback日志系统
    Springboot @Valid 参数校验
    JDK1.8 版的if else
    Android获取手机定位坐标
    CentOS8安装JDK
    Vue全局配置文件
    git学习
    百度前端面试题—基础
    前端知识网络
  • 原文地址:https://www.cnblogs.com/vihone/p/3139589.html
Copyright © 2011-2022 走看看