This is a migrated thread and some comments may be shown as answers.

Cannot format datetime under kendo gridview custom pop up editor

1 Answer 226 Views
Editor
This is a migrated thread and some comments may be shown as answers.
lucerias
Top achievements
Rank 1
lucerias asked on 11 May 2016, 10:53 AM
I have one datagridview and defined one custom pop up editor.
Please note that i have tried to apply datetime format to DOB (which is datetime field defined in Model) but it does not work. It still return data as 
"Mon Apr 18 2016 10:52:37 GMT+0800 (Malay Peninsula Standard Time)"
I have set the annotation [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy HH:mm}")] in the Model but it only displayed correctly in gridview column, when i double click and bring out the pop up editor, the date time format still show as "Mon Apr 18 2016 10:52:37 GMT+0800 (Malay Peninsula Standard Time)".

The editor content as below:
"
@model Application.Models.CustomerModel

<table class="popup-layout-tbl" style="display: table;">
<tbody>

<tr>
<td>
                <div class="k-edit-label popup-label">
                    @Html.LabelFor(model => model.CustomerID, new { @class = "popup-label-text" } )
                </div>
                <div>
                    @Html.TextBoxFor(model => model.CustomerID, new { @readonly = true, @class = "popup-input" })
                    @Html.ValidationMessageFor(model => model.CustomerID)
                </div>
</td>
</tr>

<tr>
<td>
                <div class="k-edit-label popup-label">
                    @Html.LabelFor(model => model.CustomerName, new { @class = "popup-label-text" } )
                </div>
                <div>
                    @Html.TextBoxFor(model => model.CustomerName, new { @class = "popup-input" })
                    @Html.ValidationMessageFor(model => model.CustomerName)
                </div>
  
</td>
</tr>

<tr>
<td>

                <div class="k-edit-label popup-label">
                    @Html.LabelFor(model => model.DOB, new { @class = "popup-label-text" } )
                </div>
                <div>
                    @Html.TextBoxFor(model => model.DOB, "{0:MM/dd/yyyy}", new { @readonly = true, @class = "popup-input" })
                    @Html.ValidationMessageFor(model => model.DOB)
                </div>
</td>
</tr>

</tbody>
</table>

"

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 13 May 2016, 06:40 AM
Hi,

Please examine the following forum thread that treats this issue - http://stackoverflow.com/questions/1961114/date-only-from-textboxfor

Regards,
Danail Vasilev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
lucerias
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or