ho provato così (e questo me lo conservo
)
ho notato che nel server si scatena pure l'evento Button1_Click
codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="a.aspx.vb" Inherits="prove_a" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Pagina senza titolo</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
function Button2_onclick()
{
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "", "", false, false));
if(Page_IsValid)
{
document.getElementById("Label1").style.display = "";
//document.getElementById("Button1").click();
document.getElementById("Button2").disabled = true;
document.getElementById("__EVENTTARGET").value = "Button1";
document.getElementById("form1").submit();
}
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" onkeydown="this.blur();" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="FileUpload1" ErrorMessage="Il campo non può essere vuoto"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Upload" style="display:none;" />
<input id="Button2" type="button" value="Upload" onclick="return Button2_onclick()" />
<asp:Label ID="Label1" runat="server" Text="Prego attendere: sto spedendo il file..." style="display:none;"></asp:Label>
</form>
</body>
</html>