|
-
Feb 14th, 2005, 04:43 AM
#1
Thread Starter
Lively Member
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
-
Feb 14th, 2005, 01:45 PM
#2
Retired VBF Adm1nistrator
Re: Trying to disable an HtmlIntputFile Control
Surely if the file is uploaded then you should be directing the user to another page anyway?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 14th, 2005, 07:49 PM
#3
Frenzied Member
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;"......
Magiaus
If I helped give me some points.
-
Feb 15th, 2005, 04:07 AM
#4
Thread Starter
Lively Member
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>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|