InputDateTime
概要
機能
サンプル
現在のカルチャ:
現在のカルチャ:
説明
このサンプルは、InputDateTime コントロールの基本的な使用方法を示します。
このサンプルでは、クライアント側でのメソッドchangeCultureの使用法を示します。
ソース
IndexController.cs
using System.Web.Mvc;
namespace MvcExplorer.Controllers
{
public partial class InputDateTimeController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
Index.cshtml
@{
var today = DateTime.Now.Date;
}
@section Scripts{
<script>
function applyCulture() {
var selCulture = document.getElementById("selCulture");
wijmo.changeCulture(selCulture.value).then(() => {
if (selCulture.selectedOptions.length > 0)
document.getElementById("curCulture").textContent = selCulture.selectedOptions[0].label;
});
}
</script>
@Html.C1().Scripts().Basic().Culture("ja")
@Html.C1().Scripts().Basic().Culture("de")
@Html.C1().Scripts().Basic().Culture("fr")
@Html.C1().Scripts().Basic().Culture("ko")
@Html.C1().Scripts().Basic().Culture("en")
}
<div>
<label>@Html.Raw(Resources.InputDateTime.Index_Text0)</label>
@Html.C1().InputDateTime().Value(today)
<br />
@Html.Raw(Resources.InputDateTime.Index_Text21): <label id="curCulture" style="font-size:14px;font-weight:bold;">English</label>
<select id="selCulture" size="5" style="width:200px;padding:5px;">
<option value="en" selected="selected">English</option>
<option value="ja">Japanese</option>
<option value="de">German</option>
<option value="fr">French</option>
<option value="ko">Korean</option>
</select>
<br />
<button id="btn" onclick="applyCulture()">@Html.Raw(Resources.InputDateTime.Index_Text22)</button>
</div>
@section Description{
<p>@Html.Raw(Resources.InputDateTime.Index_Text1)</p>
<p>@Html.Raw(Resources.InputDateTime.Index_Text2)</p>
}
マニュアル