0
我有兩個asp控件:一個FileUpload和一個按鈕 在FileUpload上,我添加uploadify屬性,它的工作原理 我也想使用按鈕在代碼隱藏上做一些操作,然後調用文件上傳,但該文件彈出窗口不會出現從代碼隱藏調用Uploadify
出於測試目的,我試圖減少對客戶端的所有,但它仍然無法工作......
這裏是我的三個標籤
<asp:Button Text="Browse" OnClick="Carica_File_Click" runat="server" ID="UploadButton" CssClass="Load_Button" align="center"/>
<asp:Button Text="BrowseFromClient" OnClientClick="openfileDialog();" runat="server" ID="Button1" CssClass="Load_Button" align="center"/>
<asp:FileUpload runat="server" ID="FileUploadMain" align="center" />
客戶si德
<script type="text/javascript">
$(window).load(
function() {
$("#ContentPlaceHolderMain_FileUploadMain").uploadify({
'swf': '../Scripts/uploadify.swf',
'cancelImg': '../images/uploadify-cancel.png',
'buttonText': 'Browse Files',
'uploader': '../FrontEnd/Upload.ashx<%=GetUploadParams()%>',
'folder': '',
'fileDesc': 'UPLOAD FILES',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png;*.pdf;*.doc;*.docx',
'multi': true,
'auto': true,
'buttonImage': '<%=GetUploadFileUrl()%>',
'width': 217,
'removeTimeout': 1,
'removeCompleted': false,
'buttonClass': '',
'onUploadSuccess': function() {
location.reload(true);
}
});
}
);
</script>
<script>
function openfileDialog() {
$("#FileUploadMain").click();
}
</script>
服務器端
Protected Sub Carica_File_Click(sender As Object, e As EventArgs)
Dim ClientID As String = FileUploadMain.ClientID
ScriptManager.RegisterStartupScript(Me, Page.GetType, "Script", "document.getElementById('#" & ClientID & "').click();", True)
...code
End Sub
我走到哪裏錯了?