0

I have a asp fileupload control which works okay on IE8 but now it is making the textbox clickable as well and function same as browse button.

<asp:FileUpload runat="server" ID="id" CssClass="" onchange=""/>
user2904389
  • 43
  • 1
  • 7

1 Answers1

1

FileUpload controls translates into HTML's input with type="file" control, and what you are experiencing is the default behaviour.

See: input type=file - W3.org

If for some reason you want to disable it then you can do:

    $(document).ready(function () {
        $("#<%= id.ClientID %>").click(function (e) {
        e.preventDefault();
    });
});

(the above code taken/modified from this answer)

Community
  • 1
  • 1
Habib
  • 219,104
  • 29
  • 407
  • 436
  • This is not working for me. I just want user to be able to click on browse button but not on the text box. Using XHTML 1. And the problem is in IE 11 – user2904389 Jun 24 '15 at 20:10
  • There is no direct way of doing it, You can have file input with visibility set to null, add a new button, and on the click of that button, stimulate the click on file input. See this answer http://stackoverflow.com/questions/6376452/hide-the-browse-button-on-a-input-type-file – Habib Jun 24 '15 at 20:12