Trying to disable an HtmlIntputFile Control
Hi, :)
How can I disable an HtmlInputFile Control so that is not posted back when user submit the form?
I tried this:
Code:
Sub on_Button2_Click(Sender As Object, E As EventArgs)
image_path_QA.Disabled = True
...
End Sub
...
<td><input type="file" id="image_path_QA" runat="server" size="15" /></td>
...
But it doesn’ t work, the file is posted back and the server ‘waits’ until the file added is totally uploaded. How can I ignore the control in the ‘on_Button2_Click’ subroutine?
Thanks
Re: Trying to disable an HtmlIntputFile Control
Surely if the file is uploaded then you should be directing the user to another page anyway?
Re: Trying to disable an HtmlIntputFile Control
I have a page that upload an image shows it and allows the user to upload another image.....
But, I don't understand why you would have a file upload field and not want the file to upload....
anyway add the attrib onclick="return false;" do this via code when you want it to not work. that makes the button not fire. now if they type in a file....... maybe onkeypress="return false;"......
Re: Trying to disable an HtmlIntputFile Control
Hi,
I want to do this when user presses a button to go back to previous form page. In that case, I don' t want to upload any file added, only I want to upload when the user presses another button to confirm the whole form page and to finalize the process.
I found a solution with javascript.
This is the code I used:
Code:
‘ ASP.NET code here
<html>
<head>
<script type="text/javascript">
function disable_image_pathQA() {
document.form2_newOffer.image_path_QA.disabled = true;
}
</script>
</head>
<body>
<form runat=”server”>
‘ Code here
<asp:button id=”go_back” onClick="update_data_back" onmouseup=”return disable_image_pathQA()” runat=”server” Text=”Go Back” />
<asp:button id=”go_forward” onClick="update_data_forward" onmouseup=”return validate_form()” runat=”server” Text=”Go Forward” />
</form>
</body>
</html>