The quick start guides you through the steps of adding an InputColor control to your application. For information on how to add ASP.NET MVC Edition controls, see Adding Controls.
Follow the given steps to get started:
Create a new MVC application using the ComponentOne or VisualStudio templates. For more information about creating an MVC application, see Configuring your MVC Application topic.
Add a new Controller:
Default1Controller
).Add a View for the controller:
Default1Controller
) to open it.Index()
.Index.cshtml
to open it.Index.cshtml
file with the code given below to initialize a InputColor control.
Razor |
Copy Code
|
---|---|
@using System.Drawing <script> function changeColor(sender, e) { document.getElementById("image1").style.backgroundColor = sender.value; } </script> // add an image and set its height and width <p> <img id="image1" height="300" width="400" src="@Href("~/Content/images/componentone_logo.png")" /> </p> <div> //set the background color of the image @Html.C1().InputColor().Value(Color.White).OnClientValueChanged("changeColor") </div> |