【问题标题】:how to show alert popup after finishing database processing?完成数据库处理后如何显示警报弹出窗口?
【发布时间】:2011-09-14 10:31:26
【问题描述】:

当我的按钮点击正在处理时,有什么方法可以显示显示“正在上传..”的标签?

我就是这样做的

`

protected void btnUpload_Click(object sender, EventArgs e)

{

        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);



                }

}

}

`

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

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

【问题讨论】:

  • 数据库处理在哪里完成?
  • 你是使用标准的 asp.net FileUpload 控件还是其他东西来上传?

标签: c#


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-29
    • 2020-06-05
    • 2012-08-10
    • 1970-01-01
    • 2015-03-06
    • 2015-12-16
    • 2014-05-04
    • 1970-01-01
    相关资源
    最近更新 更多