javascript onuploadcomplete function is not fired

China☆狼群 提交于 2019-12-13 03:36:36

问题


In my user control to upload files, both the client-side (funClientUploadComplete, funClientUploadError) and server-side event (uplFile1_UploadedComplete) are not getting fired. After some debugging, found out that the client-side event functions were "undefined". They are clearly defined in the HTML below. Why are they still "undefined"? How can they be successfully defined/bound? I suspect this is also the reason for server-side event function not being called. Please see code below. Appreciate your responses.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script type="text/javascript">
    function funClientUploadComplete() {
        alert('fdj-1');                            // alert box does not show
    }

    function funClientUploadError() {        
        alert('fdj-2');                            // alert box does not show    
    }

</script>

<div style="float: left;">
<asp:GridView ID="grdUploadControls" runat="server" AutoGenerateColumns="False" OnRowDataBound="grdUploadControls_RowDataBound" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:AsyncFileUpload ID="uplFile1" runat="server" OnUploadedComplete="uplFile1_UploadedComplete" OnClientUploadComplete="funClientUploadComplete"
                            OnClientUploadError="funClientUploadError" UploaderStyle="Modern" ClientIDMode="AutoID" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</div>

Code behind for server-side event: (breakpoint not hit)

   protected void uplFile1_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
    {
        // Typecast the source of this event to an AsynFileUpload
        AsyncFileUpload afux = (AsyncFileUpload)sender;
        .....
        .....
    }

Thanks for taking a look!

来源:https://stackoverflow.com/questions/16755018/javascript-onuploadcomplete-function-is-not-fired

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!