[Need help]: Issue with submit button and html file input control’s Click() method
- by somesh
Scenario:
On click of a button, we dynamically create html file input (file upload) control on the page and call that file input controls Click() method. User then selects the file from the disk. There is a “Submit” button to upload the selected file.
Problem:
The problem is, when clicked on “Submit” button first time, the input value from the file input control is cleared. And the request does not go to the server. When clicked second time, the request goes to server with empty file input value.
Why the first click on submit button does not send the request to server. And why it clears the file input control value?
Note: The issue is observed only when we call Click() method programmatically. If we let user to click browse, then in that case, the "Submit" does not clear the input value and sends request to server on first click itself.
Any help would be appreciated. Thanks in advance.
By the way, server side code is in asp.net and client side in java script, testing on IE.
-Somesh