Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Upload > RadUpload validation
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered RadUpload validation

Feed from this thread
  • Posted on May 12, 2011 (permalink)

    Hi

    How can I implement client side validation for RadUpload so user is compelled to provide a file name for upload?

    Thanks

    Regards

  • Posted on May 13, 2011 (permalink)

    Hello John,

    I achieved same functionality by using CustomValidator control. Here is the sample code.
    aspx:
    <telerik:RadUpload ID="RadUpload1" runat="server">
    </telerik:RadUpload>
    <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ClientValidationFunction1"
            ErrorMessage="CustomValidator">
    </asp:CustomValidator>

    Javascript:
    function ClientValidationFunction1(source, args)
        {
            args.IsValid = false;
            var upload = $find("<%= RadUpload1.ClientID %>");
            var inputs = upload .getFileInputs();
            for (i = inputs.length - 1; i >= 0; i--)
            {
                if (upload .getFileInputs()[i].value != "")
                {
                    args.IsValid = true;
                    return;
                }
            }
        }

    Thanks,
    Shinu.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Upload > RadUpload validation