My view has one string property. Doing a get request through an action result and sending to view -- it looks like this:
public ActionResult TeaCoffeView(string teaOrCoffee)
{
MyModel model = new MyModel();
//do some stuff
//teaOrCoffee has two values , if "T" i have
//to make the view as tea radio button selected
//or if it has "C" then coffee radio button selected
return View(model);
}
my view .cshtml
@Html.Label("tea:")
@Html.RadioButtonFor(m => m._teaOrCoffee, Model._teaOrCoffee)
@Html.Label("coffe:")
@Html.RadioButtonFor(m => m._teaOrCoffee, Model._teaOrCoffee)
Model
public string _teaOrCoffee {get; set;}
How to bind the value with @Html.RadioButtonFor
so that when loads it should show as selected?