'asp.net Catch onchange event on myfileupload to execute code behind subroutine

I want to catch when the user select a file from the myuploadfile control. so:

user click Browse
browse window opens
user select the file and hit Open button
here I want to execute some code behind

I tried this:

<asp:FileUpload runat="server" ID="MyFileUpload" Width="100%" CssClass="form-control-file" autopostback="true" onchange="modificaLnkAllegato" />

in codebehind:

 Sub modificaLnkAllegato()
        'some code
 End Sub

But don't work. How can I achieve wha I want? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source