Radupload + custom validator + call out extender

Thread is closed for posting
3 posts, 0 answers
  1. josephjijo
    josephjijo avatar
    24 posts
    Member since:
    Oct 2006

    Posted 21 May 2010 Link to this post

    I want to request at least one file for upload .
    but when i use a call out extender, its not working.

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <form id="form1" runat="server"
            <asp:ScriptManager ID="ScriptManager1" runat="server"
            <telerik:RadUpload ID="RadUpload1" InitialFileInputsCount="1" AllowedFileExtensions=".txt" 
                TargetFolder="~/uploads" runat="server" ControlObjectsVisibility="None"
            <asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="Error" 
                ValidationGroup="MyFile" ClientValidationFunction="validateRadUpload" /> 
            <cc1:ValidatorCalloutExtender ID="VCE_CustomValidator1" runat="server" TargetControlID="CustomValidator1"
        <asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="MyFile" /> 
        <script type="text/javascript"
            function validateRadUpload(source, e) { 
                e.IsValid = false
                var upload = $find("<%= RadUpload1.ClientID %>"); 
                var inputs = upload.getFileInputs(); 
                for (var i = 0; i < inputs.length; i++) { 
                    //check for empty string or invalid extension 
                    if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) { 
                        e.IsValid = true
                    else { 
                        e.IsValid = false
  2. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 26 May 2010 Link to this post

    Hello josephjijo,

    This seems to be problem with the ValidatorCallout control, not with RadUpload. I have tried to use it with custom validator, however, no avail. JavaScript error is thrown. I suggest that you use only the Custom Validator for this scenario.

    All the best,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Jeremy
    Jeremy avatar
    96 posts
    Member since:
    Mar 2010

    Posted 01 Jul 2010 Link to this post


    To use the AJAX Control Toolkit ValidatorCalloutExtender you MUST provide a ControlToValidate. Of course to use the custom validator for a radupload you don't provide a ControlToValidate :)
    I got around this by using a dummy control and it works, but the callout extender appears BEHIND the RadWindow. Any solution to this?

    <telerik:RadWindow ID="rwImport" runat="server" Behaviors="None" AutoSize="true" Modal="true" VisibleStatusbar="False" Title="Upload Something"
            <div id="divupload" style="height:140px; padding:10px;">  
                <telerik:RadUpload ID="RadUpload1" runat="server" AllowedFileExtensions=".imp" ControlObjectsVisibility="None"
                <asp:TextBox ID="dummy" runat="server" Width="0" Text="x" Height="0" BackColor="White" BorderStyle="None"
                <asp:customvalidator runat="server" id="cvUpload" display="None" clientvalidationfunction="ValidateFileExtension" ErrorMessage="Invalid file selected. Please select a file with extension '.imp'." ControlToValidate="dummy"
                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="cvUpload"
                <br /> 
                <asp:Button ID="btnImport" runat="server" CssClass="formbutton" Text="Import" onclick="btnImport_Click" /> 
                <input type="button" class="formbutton" onclick="$find('<%= rwImport.ClientID %>').close();" value="Cancel" /> 
    <script type="text/javascript"
        function ValidateFileExtension(sender, args) { 
            args.IsValid = getRadUpload('<%= rwImport.ContentContainer.FindControl("RadUpload1").ClientID %>').validateExtensions(); 
Back to Top