예제 #1
0
        public static UploadBuilder VnrUpload(this HtmlHelper helper, UploadBuilderInfo builderInfo)
        {
            var async = new Action <UploadAsyncSettingsBuilder>(a =>
            {
                a.AutoUpload(builderInfo.AutoUpload);
                if (!string.IsNullOrWhiteSpace(builderInfo.SaveUrl))
                {
                    a.SaveUrl(builderInfo.SaveUrl);
                }
            });

            var events = new Action <UploadEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(builderInfo.EventSelect))
                {
                    e.Select(builderInfo.EventSelect);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EventSuccess))
                {
                    e.Success(builderInfo.EventSuccess);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EventError))
                {
                    e.Error(builderInfo.EventError);
                }
            });

            var uploadBuilder = helper.Kendo().Upload()
                                .Async(async)
                                .Multiple(builderInfo.Multiple)
                                .ShowFileList(builderInfo.ShowFileList)
                                .Events(events)
                                .HtmlAttributes(new { style = "width:" + builderInfo.Width + "px;height:" + builderInfo.Height + ";" });

            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                uploadBuilder.Name(builderInfo.Name);
            }
            //if (builderInfo.ShowFileList)
            //{
            //    uploadBuilder.TemplateId("template-kendo-upload-file").ToClientTemplate();
            //}
            return(uploadBuilder);
        }
예제 #2
0
        public static UploadBuilder VnrUpload(this HtmlHelper helper, UploadBuilderInfo builderInfo)
        {
            var async = new Action<UploadAsyncSettingsBuilder>(a =>
            {
                a.AutoUpload(builderInfo.AutoUpload);
                if (!string.IsNullOrWhiteSpace(builderInfo.SaveUrl))
                {
                    a.SaveUrl(builderInfo.SaveUrl);
                }
            });

            var events = new Action<UploadEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(builderInfo.EventSelect))
                {
                    e.Select(builderInfo.EventSelect);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EventSuccess))
                {
                    e.Success(builderInfo.EventSuccess);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EventError))
                {
                    e.Error(builderInfo.EventError);
                }
            });

            var uploadBuilder = helper.Kendo().Upload()
                .Async(async)
                .Multiple(builderInfo.Multiple)
                .ShowFileList(builderInfo.ShowFileList)
                .Events(events)
                .HtmlAttributes(new {style="width:"+builderInfo.Width+"px;height:"+builderInfo.Height+";" });
            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                uploadBuilder.Name(builderInfo.Name);
            }
            //if (builderInfo.ShowFileList)
            //{
            //    uploadBuilder.TemplateId("template-kendo-upload-file").ToClientTemplate();
            //}
            return uploadBuilder;
        }