zoukankan      html  css  js  c++  java
  • 在新弹出页面下载

    源代码
     1 <div id="icaption">
     2         <div id="title">
     3             XML配置管理
     4         </div>
     5         <a id="btn_add" title="添加菜单" runat="server" href="AddSampleXml.aspx"></a>
     6     </div>
     7     <div id="itable">
     8         <asp:GridView ID="gv_Menu" runat="server" GridLines="None" BorderWidth="0px" CellPadding="0"
     9             CellSpacing="1" align="center" AutoGenerateColumns="false" OnRowCommand="gv_department_RowCommand">
    10             <Columns>
    11                 <asp:TemplateField HeaderText="名称">
    12                     <ItemTemplate>
    13                         <%#((System.Data.DataRowView)Container.DataItem)["ACTION"]%>
    14                     </ItemTemplate>
    15                     <ItemStyle Width="25%" />
    16                 </asp:TemplateField>
    17                 <asp:TemplateField HeaderText="下载">
    18                     <ItemTemplate>
    19                         <a href="xmlDetails.aspx?item=<%#Eval("Id") %>">下载</a>
    20                     </ItemTemplate>
    21                     <ItemStyle Width="25%" />
    22                 </asp:TemplateField>
    23                 <asp:TemplateField HeaderText="描述">
    24                     <ItemTemplate>
    25                         <%#((System.Data.DataRowView)Container.DataItem)["DESCRIPTION"]%>
    26                     </ItemTemplate>
    27                     <ItemStyle Width="25%" />
    28                 </asp:TemplateField>
    29                 <asp:TemplateField HeaderText="操作">
    30                     <ItemTemplate>
    31                         <a href="AddSampleXml.aspx?ID=<%#Eval("ID") %>" title="编辑">
    32                             <img src="../App_Themes/images/btn_edit.png" alt="编辑" border="0" />
    33                         </a>
    34                         <asp:LinkButton runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
    35                             OnClientClick="return window.confirm('您确定要删除该xml吗?')" ID="lkDelete" CausesValidation="false"
    36                             ToolTip="删除"><img src="../App_Themes/images/btn_delete.png" border="0" />
    37                         </asp:LinkButton>
    38                     </ItemTemplate>
    39                     <ItemStyle Width="25%" />
    40                 </asp:TemplateField>
    41             </Columns>
    42             <RowStyle CssClass="tr3" Font-Size="12px" Height="28px" />
    43             <HeaderStyle CssClass="itable_title" />
    44             <EmptyDataTemplate>
    45                 <tr class="itable_title">
    46                     <th width="25%">
    47                         名称
    48                     </th>
    49                     <th width="25%">
    50                         查看
    51                     </th>
    52                     <th width="25%">
    53                         描述
    54                     </th>
    55                     <th width="25%">
    56                         操作
    57                     </th>
    58                 </tr>
    59                 <tr class="tr3">
    60                     <td class="grid_no_result" colspan="4">
    61                         <span>当前没有查询记录</span>
    62                     </td>
    63                 </tr>
    64             </EmptyDataTemplate>
    65         </asp:GridView>
    66     </div>

    新页面的后台

    新页面后台
     1     BLL.NeoSampleXmlBll bll = new BLL.NeoSampleXmlBll();
     2     protected void Page_Load(object sender, EventArgs e)
     3     {
     4         if (!string.IsNullOrEmpty(Request.QueryString["item"]))
     5         {
     6             DataTable dt = bll.GetNeoSampleXmls(Request.QueryString["item"]);
     7             if (dt == null)
     8             {
     9                 return;
    10             }
    11             string content = dt.Rows[0]["content"].ToString();
    12             string action = dt.Rows[0]["action"].ToString();
    13             XmlDocument doc = new XmlDocument();
    14             doc.LoadXml(content);
    15             string s = doc.OuterXml; ;
    16             StringWriter sw = new StringWriter();
    17             sw.WriteLine(s);
    18             Response.AddHeader("content-disposition", "attchment;filename=" + action + ".xml");
    19             Response.ContentEncoding = Encoding.GetEncoding("gb2312");
    20             Response.ContentType = "application/xml";
    21             Response.Write(sw.ToString());
    22             Response.Flush();
    23             Response.End();
    24         }
    25     }
  • 相关阅读:
    How does a single thread run on multiple cores?
    一篇所有研究生都该读的好文:阳光温热 科研静好
    Running Slic3r from git on GNU Linux
    3D打印的各种问题及解决方案
    新工科的新视角:面向可持续竞争力的敏捷教学体系
    What is Modularity
    3d打印模型为什么文件格式必须是stl和stp的?
    剑指offer 39.平衡二叉树
    剑指offer 38.二叉树的深度
    剑指offer 37.数字在排序数组中出现的次数
  • 原文地址:https://www.cnblogs.com/hfliyi/p/2800176.html
Copyright © 2011-2022 走看看