ViewModel
public class ModelTypeViewModel
{
public virtual CheckRadioButton CRB { get; set; }
}
Controller
public class M1Controller : Controller
{
public CarContext db = new CarContext();
private CheckRadioButton get()
{
CheckRadioButton c = new CheckRadioButton();
c.BrandName = "abc";
c.type = "xyz";
return c;
}
public ActionResult Hello ()
{
CheckRadioButton s = get();
ModelTypeViewModel mm = new ModelTypeViewModel(s);
return View(mm);
}
View:(Hello)
@model Car.Models.ModelTypeViewModel
@Html.Partial("_Display", Model.CRB)
Partial View(_Display)
<h1> Hello </h1>
How can I pass diff model each time to to partial view?
It gives an error
"An exception of type 'System.Web.HttpParseException' occurred in System.Web.WebPages.Razor.dll but was not handled in user code"
It gives the same error even if I pass only 'Model" I am confused
_Display.cshtmlview is correct. - user3559349Modelswithout it, the question can not be answered correctly - anand