fileexplorer validation

3 posts, 1 answers
  1. Ronen
    Ronen avatar
    29 posts
    Member since:
    Aug 2010

    Posted 08 Aug 2010 Link to this post

    How do i validate upon submitting a form that the user actually selected a file in the file explorer?
  2. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 12 Aug 2010 Link to this post

    Hello Ronen,

    Selecting a file in RadFileExplorer does not cause postback to the server. In your case you need to implement your custom logic using the OnClientItemSelected event of the control. This event is fired when an item is selected.

    All the best,
    Fiko
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ronen
    Ronen avatar
    29 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post

    i already used another text box that shows the path of the file, and i used a validator to check if it's empty or doesn't contain a file:


     

     

     

    function validateFile(source, args) {

     

     

     

    var regex = /.*\..{3,4}/;

     

     

     

     

     

     

    var textBoxFileName = document.getElementById('<%=TextBoxFileName.ClientID%>');

     

     

     

    if (textBoxExistingFile != null && textBoxFileName != null)

     

    {

     

     

    if (textBoxFileName.value.length == 0 ||

     

    textBoxFileName.value.search(regex) == -1)

    {

    args.IsValid =

     

    false;

     

     

     

    return;

     

    }

    }

    args.isValid =

     

    true;

     

    }


     

     

    function fillFileName(sender, args) {

     

     

    var label = document.getElementById('<%=TextBoxFileName.ClientID%>');

     

     

    if (label != null)

     

    label.innerText = args.get_item().get_path();

    OnClientItemSelected(sender, args);

    }




     

    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" Configuration-MaxUploadFileSize="307200"

     

     

    EnableCreateNewFolder="false" EnableOpenFile="true" OnClientItemSelected="fillFileName">

     

     

    <Configuration SearchPatterns="*.jpg,*.jpeg,*.JPG,*.JPEG,*.gif,*.GIF,*.png,*.PNG" />

     

     

    </telerik:RadFileExplorer>

     

Back to Top