/// <summary> /// Initialization method for the ColorBlockUserControl. Allows running server-side code before displaying partial view. /// </summary> /// <returns>PartialView</returns> public ActionResult InitializeUserControl() { ColorModel colorModel = new ColorModel { Width = 200, Height = 200, RGBColor = "#FF0000" }; return PartialView("UserControls/ColorBlockUserControl", colorModel); }
public ActionResult DrawColor(ColorModel model) { if (ModelState.IsValid) { return Content(ColorManager.GetGradientDiv(model.RGBColor, model.Width, model.Height)); } else { return Redirect("/"); } }