1

I have the following problem when I'm browsing with IE 9 and Opera: I have a hidden aps fileupload dialog, which I trigger when the user clicks on an asp button.

<asp:LinkButton ID="btnBrowse" class="button fright marl10" OnClientClick="return openFileDialog()" runat="server" CausesValidation="false"></asp:LinkButton>

And here is the Jquery:

function openFileDialog() {
    $('#uploadPhotoDialog').click();        
    return false;
}

uploadPhotoDialog is the ID of the aps fileupload control.

I'll appreciate any answers. Thanks in advance.

Anton Belev
  • 11,963
  • 22
  • 70
  • 111

2 Answers2

1

With the fileupload, specifically, there are security and sandboxing issues. I know that there are some things the fileupload will not respond to, such as programmatic clicking, to prevent auto-uploaders and such security shenanigans.

J. Steen
  • 15,470
  • 15
  • 56
  • 63
  • I found that some browsers don't like the click event to be associated with hidden controls. So I've made the file upload opacity to 0 and now it works in Opera. However IE still makes problems, but not only on this part of my site, so may be the problem in IE is not based only on the fact that the control was hidden. – Anton Belev Jul 18 '12 at 14:12
  • IE in and of itself is a problem. ;) – J. Steen Jul 18 '12 at 14:15
0

I'm just guessing now since I don't see the source code of the page and I don't know if this is the problem.

You are using an ID to select the element. The ID changes when you are using server-tags. What if you add ClientIDMode="Static" to the upload control (You must be using .net 4.0 )? That way the id doesn't change as it does when you are using server-tags per default.

See retrieve ID of server control using jQuery for more info how to select elements with jquery when usign server-tags.

Community
  • 1
  • 1
Andreas
  • 2,336
  • 2
  • 28
  • 45