InputColor
InputColor
Overview
Features
Sample
Description
This sample shows the basic usage of the InputColor control.
Source
IndexController.cs
using Microsoft.AspNetCore.Mvc; namespace MvcExplorer.Controllers { public partial class InputColorController : Controller { public ActionResult Index() { return View(); } } }
Index.cshtml
<p> <img id="image1" src="@Href("~/Content/images/room.png")" /> </p> <div> <label>@Html.Raw(InputColorRes.Index_Text0)</label> <c1-input-color value="White" value-changed="changeColor"></c1-input-color> </div> @section Description{ @Html.Raw(InputColorRes.Index_Text1) } @section Scripts{ <script> function changeColor(sender, e) { document.getElementById("image1").style.backgroundColor = sender.value; } </script> }
Documentation