MVC3 JSCOLOR values
-
13-06-2021 - |
Pregunta
I am very new to MVC, and I am trying to get the value from JScolor in my view, but I am hitting a brick wall, and there doesnt seem to be any info out there, so how is it done? I should add I am doing this in the view, and trying to update via EF4.1.
Solución
If you are using a model in this view. You can simply write
@Html.TextBoxFor(m => m.selectedColor, new { @class = "Color" })
Where selectedColor is a property in the model
In the controller, you well get that model's property
Example Controller Code
public ActionResult SaveColor(SelColor model){
string myColor = SelColor.selectedColor;
...
..
}
In the above code, SelColor is model's name SaveColor is controller's Action
In the view, use Html.BeginForm() to call the desired controller's action.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow