當按鈕點擊正在處理時,是否有任何方式顯示顯示「正在上傳..」的標籤?如何在按鈕點擊處理過程中顯示標籤?
我這樣做這樣
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