I've attached a sample application that demonstrates using an editor template to display a DatePicker. In the sample application, I have a model called Person with a property called Birthday. The Birthday property has a UIHint attribute:
usingSystem;
usingSystem.ComponentModel.DataAnnotations;
namespaceTelerikMvcGridEditingDropdown.Models
{
publicclassPerson
{
publicintId { get; set; }
publicstringName { get; set; }
/// <summary>
/// Since HairColor is to be displayed as a dropdownlist in the grid,
/// the UIHint attribute is required.
/// </summary>
[UIHint("HairColor")]
publicstringHairColor { get; set; }
/// <summary>
/// Since Birthday is to be displayed as a datepicker in the grid,
/// the UIHint attribute is required.
/// </summary>
[UIHint("Birthday")]
publicDateTime Birthday { get; set; }
}
}
Since the grid is rendered in the /Views/Home/Index.cshtml, I have added a folder called EditorTemplates with a partial view called Birthday.cshtml at: /Views/Home/EditorTemplates/Birthday.cshtml. The Birthday.cshtml has the following code:
@model DateTime
@(
Html.Telerik().DatePicker().Value(Model)
)
Here is the grid that is defined in the /Views/Home/Index.cshtml:
Since I am updating the person by making an AJAX call to the UpdatePerson action method in the Home controller, the UpdatePerson action method will recieve a Person object containing the updated values sent from the grid. The UpdatePerson action method would be defined as:
Hi John DeVight
Thanks for your replay.Now in this you filled the drop using string[]={"value1","value2"}.Instead of that can u give an exmple to fill the combox from database using the model variables