Hello to all.
I have a scheduler with a Custom Editor.
A model with the member Image (string)
I'd like to use an Upload control in order to
1) upload the image on the server, by sending also the calendarID in case of editing an existing calendar event
2) on Save, store the file name in the Image member of the model.
At the moment I'm able to insert an Upload control in the custom Editor, but I'm not able to store the filename in the Model member (via MVVM)
Is this possible?
Should I use the "save event" of the calendar to discover the current value of the Upload control and update the model (how is possible to update the model ???)
Thanks.
My code:
member of the Model:
[Display(Name =
"Logo"
)]
public
string
Image {
get
;
set
; }
Custom Editor:
(NB: calendarID should be the ID of the current calendar in case of editing, but I don't know how :-( )
Thanks!!!
<
div
class
=
"k-edit-label"
>
@(Html.LabelFor(model => model.Image))
</
div
>
<
div
data-container-for
=
"Image"
class
=
"k-edit-field"
>
@(Html.Kendo().Upload()
.HtmlAttributes(new { accept = "image/*" })
.Name("calendarImages")
.Async(async => async
.Save("SaveImage", "Calendar", new { calendarID = 1 })
.Remove("RemoveImage", "Calendar", new { calendarID = 1 })
.AutoUpload(true)
)
.Multiple(false)
)
</
div
>