1

我想在 mvc3 中使用 kendo ui q2 2012。我使用这个链接的方式:

http://docs.kendoui.c​​om/documentation/getting-started/using-kendo-with/aspnet-mvc/introduction

但在我的剃刀视图中,而不是显示这个:

 @(Html.Kendo().Upload()
            .Name("files")
        )

它显示了这一点:

@Kendo.Mvc.UI.Upload 

我不能使用它。帮助请。谢谢...

另一个问题是我可以在 mvc3 中使用 Telerik.Web.UI 吗?当我将它添加到我上面所说的相同剑道的项目中时,它不显示 htmlHelper 类型。

4

1 回答 1

1

您可以查看上传概述帮助主题。它展示了如何在 ASP.NET MVC 中配置和使用 Kendo Upload。以下是相关代码:

查看(剃刀):


@(Html.Kendo().Upload()
        .Name("attachments")
        .Async(async => async
            .Save("Save", "Home")
        )
)

控制器:


public ActionResult Save(IEnumerable<HttpPostedFileBase> attachments)
{
    // The Name of the Upload component is "attachments"
    foreach (var file in attachments)
    {
        // Some browsers send file names with full path. We only care about the file name.
        var fileName = Path.GetFileName(file.FileName);
        var destinationPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);

        file.SaveAs(destinationPath);
    }

    // Return an empty string to signify success
    return Content("");
}
于 2013-03-06T12:15:41.250 回答