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,190
    Thanks
    10
    Thanked 569 Times in 550 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/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

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