Disable upload button programmatically

3 posts, 0 answers
  1. Tobania
    Tobania avatar
    160 posts
    Member since:
    Apr 2010

    Posted 23 Aug 2010 Link to this post


    I'm using your RadUpload control in my silverlight application. When the user has selected a file for upload, some logic is executed to determine the name and extension of the selected file and to set additional post fields. (I use the FilesSelected event for that).

    But I would like to disable the upload button programmatically when something goes wrong while this logic is executed, so that the user can not upload the file. What is the best way to implement this functionality?

  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 26 Aug 2010 Link to this post

    Hello Sodi We,

    You can access the UploadButton element (named "UploadButton") from the Controltemplate of the RadButton and disable it. A possible approach would be to use the ChildrenOfType() method to find all buttons in the control template of the RadUpload. And then disable the one named "UploadButton". However, you should keep in mind that you will have to use a Dispatcher to delay the disabling of the button a bit in order to implement this scenario.

    I prepared a sample project illustrating this approach. Give it a try and let me know if it works for you.

    All the best,
    Tina Stancheva
    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. Tobania
    Tobania avatar
    160 posts
    Member since:
    Apr 2010

    Posted 30 Aug 2010 Link to this post

    Hello Tina,

    Thank you for the sample project. This solution works for me.

    Kind regards,
Back to Top