原先都是在Datalist中显示图片的
可是图像上传之后,
不能立刻显示,
应该用什么解决办法

解决方案 »

  1.   

    if(!IsPostBack)BindData();//绑定datalist
    protected void btnUpload_Click(object sender, EventArgs e) 
        { 
            if(fileUpload.HasFile) 
            { 
                string savePath = Server.MapPath("~/upload/"); 
                if (!System.IO.Directory.Exists(savePath)) 
                { 
                    System.IO.Directory.CreateDirectory(savePath); 
                } 
                savePath = savePath + "\\" + fileUpload.FileName; 
                fileUpload.SaveAs(savePath);//保存文件 
                //保存到数据库
               BindData();
            } 
        }