ASP.NET Kendo UI上传

前端之家收集整理的这篇文章主要介绍了ASP.NET Kendo UI上传前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想使用Kendo UI开发一个网站.我可以使用其他资格的kendo-ui.但是,我无法使用ASP.NET上传文件.是否有任何示例代码或文档可以解决此问题?

解决方法

以下是它对我有用的原因:

JS:

$(document).ready(function () {
    $(".attachmentUpload").kendoUpload({
        async: {
            saveUrl: "SaveAttachment.aspx",autoUpload: true
        }
    });
});

页:

<input name="attachmentUpload" id="attachmentUpload" type="file" class="attachmentUpload" />

SaveAttachment.aspx.cs

public partial class SaveAttachment : Page
{
    protected void Page_Load(object sender,EventArgs e)
    {
        Response.Expires = -1;
        try
        {
            HttpPostedFile postedFile = Request.Files["attachmentUpload"];
            //do something with your postedfile
            Response.ContentType = "application/json";
            Response.Write("{}");
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());

        }
    }
}

SaveAttachment.aspx:

<%@ Page Language="C#" CodeBehind="SaveAttachment.aspx.cs" Inherits="Nstar.WebUI.Pages.SaveAttachment" EnableTheming="false" StyleSheetTheme="" Theme="" %>
原文链接:https://www.f2er.com/aspnet/247866.html

猜你在找的asp.Net相关文章