This is a migrated thread and some comments may be shown as answers.

How to Detect Click of RadUpload Select button

1 Answer 275 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Acadia
Top achievements
Rank 1
Iron
Acadia asked on 23 Apr 2008, 12:53 PM
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?

Thanks

1 Answer, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 23 Apr 2008, 01:17 PM
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,
Sophy
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Upload (Obsolete)
Asked by
Acadia
Top achievements
Rank 1
Iron
Answers by
Sophy
Telerik team
Share this question
or