|
Rank: Newbie Groups: Member
Joined: 7/15/2008 Posts: 2
|
Hi!
How do I check to make sure that a user uploads a file before the rest of the page is submitted?
I have a form that collects a users' name, the date, and so on. Before the user can press the submit button, want to make sure the user has uploaded a file.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
I believe the latest version supports RequiredFieldValidator. You would just set its ControlToValidate to the uploader. Previous version does not support this, but it has just been added to our latest version that is available on our download page.
Thanks
|
|
Rank: Member Groups: Member
Joined: 8/9/2007 Posts: 18
|
Hi CJ/EO,
To confirm, I've just tested this and it works like a dream (version 6.0.18.2 / Web Controls 2008).
Regards,
Richard.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Excellent. Thanks for the update!
|
|
Rank: Newbie Groups: Member
Joined: 7/15/2008 Posts: 2
|
Hi eo_support,
1. I am dynamically creating the upload control on page load and placing it in a PlaceHolder control and therefore the RequiredFieldValidator cannot find a control to validate. unless you have a better solution.
2. I created the event handler below by double clicking on the upload control but it gives me this error:
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Protected Sub AJAXUploader5_FileUploaded(ByVal sender As Object, ByVal e As System.EventArgs) Handles AJAXUploader5.FileUploaded
End Sub
Is there a better way to create an event handler for the upload control?
Thanks.
CJ
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi CJ,
For your questions:
1. I believe you will be able to set the RequiredFieldValidator.ControlToValidate with code;
2. Instead of do "AJAXUploader5 As EO.Web.AJAXUploader", you will do "WithEvents AJAXUploader5 As EO.Web.AJAXUploader";
Thanks
|
|