簡體   English   中英

使用kendo中綁定的Grid列將字符串從view(Razor)傳遞到Editor模板

[英]Pass string from view(Razor) to Editor Template using Grid column bound in kendo

我想使用kendo網格列綁定將字符串從view(razor)傳遞到Editor Template。 我正在使用上載文件(編輯器模板)。 我嘗試使用“ EditorViewdata()”傳遞字符串,但是它不起作用。 我的編輯器模板是:

    @model string
    @(Html.Kendo().Upload()
.Name("FileUrl")
.Events(events =>
{
    events.Select("onSelectFile");
    events.Success("onUploadSuccessFile");
})
.Messages(messages =>
{
    messages.Select("Upload");
})
.Enable(true)
.Async(async =>
{
async.Save("SaveFile", "Products");
async.Remove("DeleteFile", "Products");
async.AutoUpload(true);
})
.Multiple(false))

和我的列綁定是:

columns.Bound(e => e.FileUrl).EditorTemplateName("FileUrl").Title("File");

我該怎么做 ??

使用EditorViewData是最簡單的方法。 確保您正在這樣使用它:

columns.Bound(e => e.FileUrl).EditorTemplateName("FileUrl").EditorViewData(new { stringName = stringValue }).Title("File");

然后,在編輯器模板中,可以通過調用ViewData["stringName"]獲得值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM