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

[Solved] Time is not displayed in edit form in grid

1 Answer 19 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Petr
Top achievements
Rank 1
Petr asked on 16 Dec 2011, 09:47 PM
Hello
I use MVC 3.0..0 (run-time version v4.0.30319)

here is code for form

   @{ Html.Telerik().EditorFor(m => m.FullDescription)
           .Name("FullDescription")
           .HtmlAttributes(new { style="width:100%;height:400px;position" })
           .Encode(false)
    
               .Render();
    }
 @(Html.LabelFor(m => m.Description)) @(Html.TextBoxFor(m => m.Description, new { style="width:400px;position:relative" }))
@(Html.LabelFor(m => m.Date))@(Html.EditorFor(m=>m.Date))



here is model

   
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web.Mvc;
 
namespace VCustoms.Business
{
    public class News
    {
 
        #region Mapped
 
        [Key]
        public int NewsID { get; set; }
        [DisplayName("Название")]
        public string Description { get; set; }
        [DisplayName("Значение")]
        [AllowHtml]
        [DataType(DataType.MultilineText)]
        public string FullDescription { get; set; }
        [DisplayName("Дата")]
        [DataType(DataType.DateTime)]
   
        public DateTime Date { get; set; }
 
 
        #endregion
    }
 
}

here is code for grid




@{
    ViewBag.Title = "Новости";
}
 
@(Html.Telerik().Grid<VCustoms.Business.News>()
        .Name("News")
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Update("Update", "News")
                .Select("Select", "News")
                .Delete("Delete", "News")
                .Insert("Insert", "News");
                 
        }
        )
        .DataKeys(keys =>
        {
            keys.Add(n => n.NewsID).RouteKey("NewsID");
        })
        .Columns(columns =>
        {
  
             
            columns.Bound(b => b.FullDescription);
            columns.Bound(b => b.Description);
            columns.Bound(b => b.Date);
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Text);
                commands.Delete().ButtonType(GridButtonType.Text);
                
 
            }).Width(180).Title("");
        })
        .ToolBar(commands =>
        {
            commands.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new { style = "margin-left:0" });
        })
        .Editable(editing =>  editing.Mode(GridEditMode.InForm) )
         
        )


here is controller
     
 
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult Select()
{
    using (Db db = new Db())
    {
 
        return View(new GridModel(db.News.ToList<News>()));
    }
}


grid of news displayed  http://clip2net.com/s/1piih 
date is displayed correctly

but when i go in edit mode - look - http://clip2net.com/s/1pijs
time part is not shown

What should I do ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Petr
Top achievements
Rank 1
answered on 17 Dec 2011, 06:35 AM
I have added 
@{ Html.Telerik().ScriptRegistrar().Globalization(true); }
and problem disappeared
Tags
Date/Time Pickers
Asked by
Petr
Top achievements
Rank 1
Answers by
Petr
Top achievements
Rank 1
Share this question
or