Cannot format datetime under kendo gridview custom pop up editor

2 posts, 0 answers
  1. lucerias
    lucerias avatar
    16 posts
    Member since:
    Nov 2011

    Posted 11 May Link to this post

    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>

    "
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 13 May Link to this post

    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
  3. Kendo UI is VS 2017 Ready
Back to Top