0
我有一個關於kendo彈出編輯器圖像瀏覽器功能的問題。我只想將圖像路徑存儲到數據庫中,但Kendo似乎想要將完整的圖像標籤放入數據庫中。Kendo網格彈出編輯器圖像瀏覽器
我該如何去使圖像瀏覽器只把路徑放入數據庫?
這裏是圖像瀏覽器自定義模板:
@model com.RomanceCoachOnTheGo.MVC.Models.MaleCategory
@(Html.Kendo().Editor()
.Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
//.Value(Model.Icon)
.Tools(tools => tools.Clear().InsertImage())
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/Mobile/Images/{0}")
.Read("Read", "ImageBrowser")
.Create("Create", "ImageBrowser")
.Destroy("Destroy", "ImageBrowser")
.Upload("Upload", "ImageBrowser")
.Thumbnail("Thumbnail", "ImageBrowser"))
)
這是MaleCategory查看:
@{
ViewBag.Title = "MaleCategory";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@(Html.Kendo().Grid<com.RomanceCoachOnTheGo.MVC.Models.MaleCategory>()
.Name("MaleCategories")
.ToolBar(toolbar =>
{
toolbar.Create();
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(item => { item.Id(m => m.MaleCategoryKey); })
.Create(c => c.Action("CreateMaleCategory", "Administrator"))
.Read(r => r.Action("ReadMaleCategory", "Administrator"))
.Update(u => u.Action("UpdateMaleCategory", "Administrator"))
.Destroy(d => d.Action("DeleteMaleCategory", "Administrator"))
)
.Columns(col =>
{
col.Bound(c => c.Title);
col.Bound(c => c.Description);
col.Bound(c => c.SortOrder);
col.Bound(c => c.Icon);
col.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.Editable(editing => editing.Mode(GridEditMode.PopUp).TemplateName("EditCreateMaleCategory"))
.Sortable()
.Pageable()
.Filterable()
)
這裏是MaleCategory型號
public class MaleCategory : FiveTalentLookupModelBase
{
[Key]
[ScaffoldColumn(false)]
[DisplayName("Male Category")]
public Int64 MaleCategoryKey { get; set; }
[UIHint("MaleCatIcon")]
public String Icon { get; set; }
}
下面是引用EditCreateMaleCategory模板:
@model com.RomanceCoachOnTheGo.MVC.Models.MaleCategory
@Html.HiddenFor(model => model.MaleCategoryKey)
@Html.HiddenFor(model => model.BusinessActions)
@Html.HiddenFor(model => model.IsDefault)
@Html.HiddenFor(model => model.IsActive)
@*Display Titles*@
<div class="editor-label">
@Html.LabelFor(model => model.Title)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
@*Display Description*@
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>
@*Display Sort Order*@
<div class="editor-label">
@Html.LabelFor(model => model.SortOrder)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.SortOrder)
@Html.ValidationMessageFor(model => model.SortOrder)
</div>
@*Display Icon*@
<div class="editor-label">
@Html.LabelFor(model => model.Icon)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Icon)
@Html.ValidationMessageFor(model => model.Icon)
</div>
對不起這個花了這麼長期以來,還有其他優先事項。我想保留數據庫中的全部源屬性,所以我想保留「〜/ Mobile/Images/{0}」。我的問題是,當我使用Kendo圖像編輯器時,它將「」插入DB。我需要刪除它,並將其設置爲只將src路徑放入數據庫 –