display some hidden label after file upload

  • Thread starter Thread starter Tony WONG
  • Start date Start date
T

Tony WONG

i tried to show hidden label and hidden button after successful upload. it
fails

but i tried to put to UNsuccessful upload, it works.

Could i have your advice? Thanks a lot.

************************************
Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles
FormView1.ItemUpdating
If postedFile.HasFile Then
If postedFile.PostedFile.ContentLength <= 2097152 Then
postedFile.SaveAs("e:\" + Request.QueryString("year") + "\"
+ myFileName.Text)
FormView1.FindControl("LabelOversize3").Visible = True
FormView1.FindControl("UploadButton").Visible = False
Else
e.Cancel = True
FormView1.FindControl("LabelOversize2").Visible = True
End If
End If
End Sub
 
Tony WONG said:
i tried to show hidden label and hidden button after successful upload.
it fails

but i tried to put to UNsuccessful upload, it works.

Could i have your advice? Thanks a lot.

************************************
Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles
FormView1.ItemUpdating
If postedFile.HasFile Then
If postedFile.PostedFile.ContentLength <= 2097152 Then
postedFile.SaveAs("e:\" + Request.QueryString("year") + "\"
+ myFileName.Text)
FormView1.FindControl("LabelOversize3").Visible = True
FormView1.FindControl("UploadButton").Visible = False
Else
e.Cancel = True
FormView1.FindControl("LabelOversize2").Visible = True
End If
End If
End Sub


is this AJAX? If so, you will not be able to update controls on the client
side using server side script in this manner.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

********************************************************
| Think outside the box! |
********************************************************
 
Thanks it is ok now.

the label and button were embedded in edit template cause this error
 
Thanks Gregory.

How should i disable the button to avoid further upload action

Add a JavaScript routine to the button after it is clicked and then enable
it again after upload is completed.

One good product for upload, that handles a lot of this plumbing is
http://www.telerik.com/products/aspnet-ajax/upload.aspx

If you want to code your own, check this out
http://bit.ly/ADtRk

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Thanks a Gregory

it is a new idea to me.


Gregory A. Beamer said:
Add a JavaScript routine to the button after it is clicked and then enable
it again after upload is completed.

One good product for upload, that handles a lot of this plumbing is
http://www.telerik.com/products/aspnet-ajax/upload.aspx

If you want to code your own, check this out
http://bit.ly/ADtRk

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top