c# - Telerik RadAsyncUpload after validation file missing
问题描述
May I ask about How to keep the file after validation for Telerik RadAsync Upload.
<telerik:RadScriptManager runat="server" ID="RadScriptManager"></telerik:RadScriptManager>
<telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" ID="RadAsyncUpload1"></telerik:RadAsyncUpload>
I had put the Ajax settings, but its not work.
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAsyncUpload1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAsyncUpload1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
解决方案
Here is the client validation function of the validator:
<telerik:RadAsyncUpload ID="RadAsyncUpload2" runat="server" Skin="Outlook" MultipleFileSelection="Automatic"></telerik:RadAsyncUpload>
<asp:CustomValidator runat="server" ID="CustomValidator1" ClientValidationFunction="validateUpload2"
ErrorMessage="This is Required Field" ForeColor="Red"></asp:CustomValidator>
<script type="text/javascript">
function validateUpload2(sender, args) {
var upload = $find("<%=RadAsyncUpload2.ClientID%>");
args.IsValid = upload.getUploadedFiles().length != 0;
}
</script>
Here is the server validation function of the validator:
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = (RadAsyncUpload2.UploadedFiles.Count == 0);
}
推荐阅读
- java - 如何在类路径的开头添加一个 jar?
- swift - SwiftUI List 横向暴露白色背景
- vba - 在欢迎表单上显示登录名
- mysql - 如何在单个查询中根据创建日期和另一列分组获取上一条和下一条记录?
- typo3 - Typo3 10.4.1 使用文件 ref 扩展页面
- python-3.x - 如何从 Bash 脚本中获取价值(linux)
- flutter - 如何向 SliverToBoxAdapter 内的水平 ListView 添加标题?
- acumatica - INTran 不显示 LotNumberNbr
- git - 删除分支的第一个推送提交
- django - Django m2m 签入 pre/post_save 信号