Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If I call click method of file input control, next click of asp:button ignored

    If I use the code below and click btnDummy, which calls the click method of the file input control with runat="server", after selecting a file if I try to click Button1 which is a server side button, it will ignore the first click. If I click it a second time it works. If I remove runat="server" from the file input control, it will not ignore the first click. Any idea why this happens? Thanks!

    Code:
    <input type="button" id="btnDummy" value="Test Click" onclick="editLabel();" />
    <input type="file" id="PathFileUploadOutside" runat="server" style="display: none;" contenteditable="false" onchange="fileChange();" />
    <input type="text" id="FilePath" />
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Load Grid" />
    
    
    function editLabel() {
                document.getElementById("PathFileUploadOutside").click();
            }
    
    function fileChange() {
                var filepath = document.getElementById("PathFileUploadOutside").value;
                document.getElementById("FilePath").value = filepath;
               }

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,277
    Thanks
    10
    Thanked 581 Times in 562 Posts
    this is not a javascript question; there's no such thing as runat in HTML or javascript.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •