Welcome Guest Search | Active Topics | Sign In | Register

using validation controls with AjaxUploader Options
trystanc
Posted: Monday, October 29, 2007 7:57:21 AM
Rank: Member
Groups: Member

Joined: 10/4/2007
Posts: 15
Hi,

I am doing some evaluation of the AjaxUploader control and I noticed that you can't reference the control in the 'Control to Validate' property of the asp.net validation controls.

Is there a way to get this working or do you have a suggested workaround?

I want to make sure that a file has been uploaded before allowing form submission. Ideally postback should be prevented and a warning message displayed in the validation summary control in order to be consistent with the validation of other controls.

Thanks
eo_support
Posted: Monday, October 29, 2007 8:23:12 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can use a CustomValidator to do that. Put the CustomValidator into the form and give it ClientValidationFunction. The following code demonstrates how to do it. Make sure you use build 4.0.43 to run this code:

Code: JavaScript
function check_uploader(source, arg)
{
    //Here the code access an internal variable "aans".
    //in build 4.0.43, this contains the list of uploaded files.
    //The variable name changes from build to build, so
    //this code only works on this specific build. We will
    //provide a public documented function to access
    //this variable in our next release 
    arg.IsValid = AJAXUploader1.aans.length >= 1;
}


Code: HTML/ASPX
<asp:CustomValidator ClientValidationFunction="check_uploader" .... />


Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.