Hello,
I am using CustomeditorTemplate for add/edit new Event. I have a Attendes mutiselect box and bydefault it should load the loggedin user. If i set the Default value then i can see the value selected but on save click Attendees is always null. but if i remove and add again or add another then i get the value. So somehow the Change Event is not triggered when Setting Default value.
here is view code. Charlie is set Default so it Shows selected but on save click attendees is null.
<div class="k-edit-label">
@(Html.LabelFor(model => model.Attendees))
</div>
<div data-container-for="Attendees" class="k-edit-field">
@(Html.Kendo().MultiSelectFor(model => model.Attendees)
.HtmlAttributes(new { data_bind = "value:Attendees" })
.DataTextField("Text")
.DataValueField("Value")
.Value(new[] { new {Text="Charlie",Value="3" }})
.ValuePrimitive(true)
.TagTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=Text\\#")
.ItemTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=Text\\#")
.BindTo(new[] {
new { Text = "Alex", Value = 1, Color = "\\#f8a398" },
new { Text = "Bob", Value = 2, Color = "\\#51a0ed" },
new { Text = "Charlie", Value = 3, Color = "\\#56ca85" }
})
)
</div>
Anamika
I am using CustomeditorTemplate for add/edit new Event. I have a Attendes mutiselect box and bydefault it should load the loggedin user. If i set the Default value then i can see the value selected but on save click Attendees is always null. but if i remove and add again or add another then i get the value. So somehow the Change Event is not triggered when Setting Default value.
here is view code. Charlie is set Default so it Shows selected but on save click attendees is null.
<div class="k-edit-label">
@(Html.LabelFor(model => model.Attendees))
</div>
<div data-container-for="Attendees" class="k-edit-field">
@(Html.Kendo().MultiSelectFor(model => model.Attendees)
.HtmlAttributes(new { data_bind = "value:Attendees" })
.DataTextField("Text")
.DataValueField("Value")
.Value(new[] { new {Text="Charlie",Value="3" }})
.ValuePrimitive(true)
.TagTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=Text\\#")
.ItemTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=Text\\#")
.BindTo(new[] {
new { Text = "Alex", Value = 1, Color = "\\#f8a398" },
new { Text = "Bob", Value = 2, Color = "\\#51a0ed" },
new { Text = "Charlie", Value = 3, Color = "\\#56ca85" }
})
)
</div>
Anamika