Hello
I have a grid containing a list of work items with a detail template displaying details about each item. The detail template is a tabstrip where one tab contains the date and text for the last action taken on that work item. I'm having trouble setting the date in a datepicker.
Here is the code for the tab:
items.Add().Text("Last action").Content(@<
text
>
#var ldate=kendo.toString(lastActionDate, "yyyy-MM-dd")#
<
div
class
=
'cssLastAction'
>#=ldate#
<
div
>lastActionDate">@(Html.Kendo().DatePicker().Name("#=ldate#").Value("#=ldate#").ToClientTemplate())</
div
>
<
textarea
rows
=
"10"
class
=
"textArea"
id
=
"lastAction"
name
=
"lastAction"
data-bind
=
"value:lastAction"
>#= lastAction # </
textarea>
</
div
>
</
text>
);I have removed some unnecessary code to keep it readable. First I take my lastActionDate from the model and format it to a string, after that I just write the result on the screen #=ldate# to see that I get a value.
I then also write it as name for the datepicker, again to see that i get the value when inspecting the datepicker .Name("#=ldate#")
Last of all i also write it as the value of the datepicker .Value("#=ldate#")
The problem is that when I inspect the datepicker it doesn't even have a value attribute.
BUT if I instead hardcode a value .Value("1950-01-01") everything works fine.
Why is it that ldate work in the name field but not in the value field for the datepicker and why does the hardcoded value work but the variable parsed as a string doesn't?
Best regards
Jonas