InputTime
InputTime
Custom Time
Features
Sample
Description
This sample shows how to customize time items by binding an collection.
Source
CustomTimeController.cs
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
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>;
DateTime dt = DateTime.Parse("11:35");
}
<div>
<label>@Html.Raw(InputTimeRes.CustomTime_Text0)</label>
<c1-input-time value="dt" format="H:mm">
<c1-items-source source-collection="timeList"></c1-items-source>
</c1-input-time>
</div>
@section Description{
@Html.Raw(InputTimeRes.CustomTime_Text1)
}
Documentation