disable button on client file select

Thread is closed for posting
2 posts, 0 answers
  1. Craig Wallace
    Craig Wallace avatar
    118 posts
    Member since:
    Jan 2005

    Posted 10 Oct 2013 Link to this post

    I want to disable another button on my page when the user chooses a file for upload.  It looks like this has to be client side, which is fine, but when I wire up the OnClientAdding function it gets called when the page loads, and the ClientID of the RadUpload control evaluates to null.

    How can I achieve what I want?

    Thanks.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Oct 2013 Link to this post

    Hi Craig,

    You can hook to the OnClientFileSelected client side event to disable any control on the page when a file is selected for uploading. Please check the following sample code I tried which works fine at my end. Also note that the OnClientAdding event fires (even at the time of loading the page) when a row is about to be added to the RadUpload control.

    ASPX:
    <telerik:RadUpload ID="RadUpload1" runat="server" OnClientFileSelected="OnClientFileSelected">
    </telerik:RadUpload>
    <br />
    <telerik:RadButton ID="RadButton1" runat="server" Text="Click">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function OnClientFileSelected(sender, args) {
            var radbutton = $find('<%=RadButton1.ClientID %>');
            radbutton.set_enabled(false);
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top