首页新闻找找看学习计划

向用户传输一个文件(TransmiteFile)后,对控件(Repeater,TextBox)的操作不起作用了

0
[待解决问题]

aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox ID="txtTest" runat="server" Text="tes"></asp:TextBox>
        <asp:Repeater  ID="repTest" runat="server">
            <ItemTemplate>
            <%#Eval("name") %>
            <%#Eval("value") %>
            </ItemTemplate>
        </asp:Repeater>
        <asp:FileUpload ID="fupTest" runat="server" />
        <asp:Button runat="server" ID="btnTest" Text="upload" OnClick="btnUploadEventClick" />
    </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;
using System.Threading; 
namespace WebApplication4
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
        public void BindData()
        {
            Random rand = new Random();
            repTest.DataSource = new[] { 
              new {name="aa",value=rand.Next()}, 
              new {name="bb",value=rand.Next()}, 
              new {name="cc",value=rand.Next()}, 
              new {name="dd",value=rand.Next()}, 
              new {name="dd",value=rand.Next()}, 
              new {name="dd",value=rand.Next()}, 
            };
            repTest.DataBind();
        }
        protected void btnUploadEventClick(object sender, EventArgs e)
        {
            string phyPath = Server.MapPath("");
            fupTest.SaveAs(phyPath+"/test.txt");

           
            TransmiteFile();// 有这个方法,导致对Repeater,和txtTest 的更新不起作用,注释后,可以对控件实现更新 
            txtTest.Text = "changed";
            BindData();
        }
        protected void TransmiteFile()
        {
            string phyPath = Server.MapPath("");
            Response.ContentType = "application/x-zip-compressed";
            Response.AddHeader("Content-Disposition", "attachment;filename=z.zip");
            Response.TransmitFile(phyPath + "/test.txt");
          //  Response.End();
        }
    }
}
symphony2010的主页 symphony2010 | 初学一级 | 园豆:99
提问于:2012-09-14 17:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册