如何在提交代码后重置RadAsyncUpload

本文关键字:RadAsyncUpload 代码 提交 | 更新日期: 2023-09-27 18:00:36

我想知道如何重置(清除)RadAsyncUpload并使组件保持初始状态

提交后在代码后面?


我的aspx::

<telerik:RadAsyncUpload runat="server" ID="rada_attach" OnClientFileUploaded="onClientFileUploaded"
MultipleFileSelection="Disabled" InitialFileInputsCount="1" MaxFileInputsCount="1"
Width="100%" />

如何在提交代码后重置RadAsyncUpload

尝试添加以下代码以点击提交按钮的事件处理程序(未测试)

ScriptManager.RegisterStartupScript(this, this.GetType(), "clearUpload", String.Format("$find('{0}').deleteAllFileInputs()", rada_attach.ClientID), true);

您想在上传后清除项目列表吗?如果是,根据这个链接,你可以这样做:

<script type="text/javascript">
   function clientFileUploaded(sender, args) {
       var count = sender._getRowCount();
       if (count > 2) {
           Array.removeAt(sender._uploadedFiles, 0);
           sender.deleteFileInputAt(0);
           sender.updateClientState();
       }
   }