How to Detect Click of RadUpload Select button

Thread is closed for posting
2 posts, 0 answers
  1. Acadia
    Acadia avatar
    204 posts
    Member since:
    May 2005

    Posted 23 Apr 2008 Link to this post

    Is there any way to detect the actual click event of the RadUpload Select button on the client side?  In other words when the user clicks Select to browse for a file, I want to immediately call a javascript function.  I understand that the control has to do a postback, but can call a javascript function before it does the postback?

    Also, is there a way to detect, on the client side, that a file was actually selected?

  2. Sophy
    Sophy avatar
    636 posts

    Posted 23 Apr 2008 Link to this post

    Hello Acadia,

    I suggest you using the OnClientFileSelected event which the RadUpload control provides and set a javascript function for an event handler to implement your custom logic. Please, refer to this help article for more details about this client-side event and a sample code-snippet demonstrating its use.

    Regarding the other question about detecting whether a file has actually been selected, you can check the value of the file input field via javascript - use the get_fileInputField to get the input field of the selected file which the eventArgs of the OnClientFileSelected provide. However, if you want to avoid someone type a path in the file input field instead of using the Browse dialog for selecting a file you can set the ReadOnlyFileInputs property of the RadUpload control to true.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top