2011-06-14 51 views
0

有没有什么办法显示标签,显示“上传..”,而我的按钮点击正在处理?如何在完成数据库处理后显示警报弹出窗口?

我这样做这样

`

保护无效btnUpload_Click(对象发件人,EventArgs的)

{ 

     lblOutput.Text="uploading.."; 


    HttpPostedFile postedFile = FileUpload1.PostedFile; 
    string ClientFileName, ServerFileName; 

    if ((FileUpload1.HasFile && FileUpload1.PostedFile != null) || txtUrl.Text!="") 
    { 
     try 
     { 
      HttpPostedFile myFile = FileUpload1.PostedFile; 

      if (fileType == "Image") 
      { 
       if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".png" || fileExt == ".bmp" || fileExt == ".tif") 
       { 





        ServerFileName = System.IO.Path.Combine(ServerSavePathI, ClientFileName); 

        string serverPath = Server.MapPath(ServerFileName); 

        FileUpload1.SaveAs(serverPath); 


        dbInsert(fileType, fileName, fileExt, filePath+fileType+"/"+fileName.Replace(" ",string.Empty)+fileExt, url); 



       } 

}

}

`

但它显示在我的文件已被上传后。

我做错了什么?还是有其他方法可以做到这一点?

+0

哪里*数据库处理*做了什么? – 2011-06-14 05:51:59

+0

你是否使用标准的asp.net FileUpload控件或其他东西来上传? – 2011-06-14 05:55:16

+0

是的我使用asp:FileUpload – 2011-06-14 06:02:40

回答

0

在btnUpload_Click方法的末尾添加以下代码:ClientScript.RegisterStartupScript(this.GetType(), "FileUploadMessage", "jAlert('success', 'Your file has been uploaded.', 'Success Dialog');", true);

+0

它工作,因为它假设to.thanks。 – 2011-06-14 06:16:07

相关问题