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=""/>
1
  • This behavior is by design. Commented Jun 24, 2015 at 18:52

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

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
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 stackoverflow.com/questions/6376452/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.