RadUpload in Radgrid FormTemplate: Client-Side Validation

Thread is closed for posting
3 posts, 0 answers
  1. Clarence
    Clarence avatar
    9 posts
    Member since:
    Nov 2008

    Posted 07 Jan 2009 Link to this post

    Hi,
        Does anyone know of a way to validate a RadUpload that is located inside of a RadDrid's FormTemplate via JavaScript.  I want to validate these two things: 1) That the RadUpload contains a file. 2) That the RadUpload's File contains a valid extensions.  I have looked at some tutorials for Client-Side validation, but none show how to validate a control within the FormTemplate.

    Thanks in advance,
    Clarence
  2. Mahesh
    Mahesh avatar
    2 posts
    Member since:
    Sep 2011

    Posted 06 Sep 2012 Link to this post

    We are having the same problem , please provide the solution to this issue.

    Thanks,
    Mahesh
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 10 Sep 2012 Link to this post

    Hi Mahesh,

    You can check whether the upload control has a file uploaded with the following code:
    if ($telerik.findControl(document, "RadAsyncUpload1")._uploadedFiles.length > 0)
    ...

    As for the file extension validation, you can use RadAsyncUpload's AllowedFileExtensions property. A demonstration on how to use the property can be found in the following demo:
    http://demos.telerik.com/aspnet-ajax/upload/examples/async/validation/defaultcs.aspx?product=asyncupload 

    Regards,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top