当按钮点击正在处理时,是否有任何方式显示显示“正在上传..”的标签?如何在按钮点击处理过程中显示标签?
我这样做这样
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);
}
}
}
}
}
但它表明我的文件已经被上传后。
我做错了什么,或者有什么其他的方式来做到这一点?
唉.......代码格式? – Aamir 2011-06-14 06:55:13
lblOutput.visible = false?只是猜测不阅读整个事情因为它就像上面所述(难以阅读) – Ruben 2011-06-14 06:56:33
不,用你目前的逻辑是不可能的。你最好的选择是使用AJAX而不是PostBack,然后这样的事情变得很微不足道。 – 2011-06-14 06:57:17