<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="width: 760px">
  <tr>
    <td style="width: 760px; text-align: center">
      <a href='<%# SetFileUrl(DataBinder.Eval(Container.DataItem, "ContentName"))%>'>
        <%# SetFileName(DataBinder.Eval(Container.DataItem, "ContentName"))%></a>
    </td>
  </tr>
  <tr>
    <td style="width: 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="width: 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>");
    }
  }
}

DataList删除操作的更多相关文章

  1. Entity Framework 6 Recipes 2nd Edition(10-8)译 - >映射插入、修改、删除操作到存储过程

    10-8. 映射插入.修改.删除操作到存储过程 问题 想要映射插入.修改.删除操作到存储过程 解决方案 假设已有运动员实体模型,如Figure 10-8所示. 对应的数据库表如Figure 10-9所 ...

  2. Entity Framework 6 Recipes 2nd Edition(10-10)译 - > 为TPH继承的插入、更新、删除操作映射到存储过程

    10-10. 为TPH继承的插入.更新.删除操作映射到存储过程 问题 TPH继承模型,想把它的插入.修改.删除操作映射到存储过程 Solution 假设数据库有一个描述不同种类的产品表(Product ...

  3. JSON相关知识,转载:删除JSON中数组删除操作

    一:JSON是什么 JSONg格式:对象是一个无序的“名称/值”对的集合. 对象以括号开始,括号结束. 名称冒号分隔值. "名称/值"之间用逗号分隔 例: var people = ...

  4. webform 光棒效果,删除操作弹出确定取消窗口

    鼠标移入onmouseover和鼠标移出onmouseout,代码里没大写我这也就不大写了.那首先,我们得获取Class为tr_item里的所有东西,也就是项标签里的数据.然后呢,我们定义一个oldC ...

  5. UVa 11987 Almost Union-Find(支持删除操作的并查集)

    传送门 Description I hope you know the beautiful Union-Find structure. In this problem, you’re to imple ...

  6. 使用Ajax实现的批量删除操作(C#)

    今天做了一个简单的批量删除操作,虽然简单,但是很多问题出现,终究还是技术不够熟练. 现在在这里跟大家分享一下.仅供学习... 1.在前台获取用户点击的信息id,把这里id封装到一个数组里面:(rows ...

  7. mySql事务_ _Java中怎样实现批量删除操作(Java对数据库进行事务处理)?

      本文是记录Java中实现批量删除操作(Java对数据库进行事务处理),在开始之前先来看下面这样的一个页面图: 上面这张图片显示的是从数据库中查询出的出租信息,信息中进行了分页处理,然后每行的前面提 ...

  8. RCP:导航器视图删除操作快捷键失效的解决方案

    导航器视图按下“Delete”的时候,会触发删除节点的操作.如果失效,按以下步骤检查: 1.在要删除的节点上点击右键,确定删除操作是否生效.如果没有生效,则按下列位置 a)检查navigator扩展配 ...

  9. 数据库的SQL语句创建和主外键删除操作

    create table UserType ( Id ,), Name nvarchar() not null ) go create table UserInfo ( Id ,), LoginPwd ...

随机推荐

  1. 【KMP算法】字符串匹配

    一.问题 给定两个字符串S(原串)和(模式串)T,找出T在S中出现的位置. 二.朴素算法 当S[i] != T[j]时,把T往后移一位,回溯S的位置并重新开始比较.    (1) 成功匹配的部分(AB ...

  2. Django 基本命令

    1. 新建一个 django project django-admin.py startproject project-name 一个 project 为一个项目,project-name 项目名称, ...

  3. C# 的一些语法特性

    1.? -NullableC# 里像int,bool,double 这样的struct和enum类型都不能为null.如果确实想在值域上加上null的话,Nullable就派上用场了.T?是Nulla ...

  4. track message forwards, avoiding request loops, and identifying the protocol capabilities of all senders along the request/response chain

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html The TRACE method is used to invoke a remote, ...

  5. iOS用户信息单例的创建

    UserInfo.h + (UserInfo *) sharedInstance; UserInfo.m #import "UserInfo.h" static UserInfo ...

  6. fullpage 插件学习心得

    fullpage.js 是一个基于jquery 的插件,它能够轻松的制作出高大上的全屏网站,主要功能有; 1.支持鼠标滚动 2.支持前进后退和键盘控制 3.多个回调函数 4.支持 CSS3 动画 5. ...

  7. Python 代码覆盖率统计工具 coverage.py

    coverage.py是一个用来统计python程序代码覆盖率的工具.它使用起来非常简单,并且支持最终生成界面友好的html报告.在最新版本中,还提供了分支覆盖的功能. 官方网站: http://ne ...

  8. CSS之伪元素

    1. :first-line 向元素的首行文本添加样式,不必关心首行是元素节点还是文本节点 <style> body,htm,div,p{ margin:0; padding:0; } d ...

  9. 如何消除MyEclipse导入jQuery库后出现的错误标记

    由于MyEclipse提供比较严谨的js校验功能,因此jQuery等前端框架导入到MyEclipse后均会提示错误,比较难看,如果要将校验去掉可以遵循下面步骤:1.点击菜单“MyEclipse”-&g ...

  10. DER input, Integer tag error的异常处理

    1.首先我向大家介绍一下我做的东西,发生这个异常的情况. 我做的是一个电签的系统,在调用某公司的API生成证书,然后与安证通进行同步证书的任务. 2.问题具体的异常 具体异常如下: 2016/08/2 ...