InputTime
InputTime
Custom Time
Features
Sample
Description
This sample shows how to customize the time items by binding to a collection.
Source
CustomTimeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcExplorer.Models;
namespace MvcExplorer.Controllers
{
public partial class InputTimeController : Controller
{
public ActionResult CustomTime()
{
ViewBag.TimeList = new List<object> { "8:20", "10:00", "11:35", "12:08", "13:25", "13:30", "14:26" };
return View();
}
}
}
CustomTime.cshtml
@{
var timeList = ViewBag.TimeList as List<object>;
}
<div>
<label>@Html.Raw(Resources.InputTime.CustomTime_Text0)</label>
@(Html.C1().InputTime().Bind(timeList).Value(DateTime.Parse("11:35")).Format("H:mm"))
</div>
@section Description{
@Html.Raw(Resources.InputTime.CustomTime_Text1)
}
Documentation