public ActionResult MyActionMethod(MyModel model)
{
//some code
string myVar= ActionMethod2(model).toString();
//use myVar
Method3(myVar, otherVar);
}
public ActionResult ActionMethod2()(MyModel model)
{
return View(model);
}
private Method3(string myVar, int otherVar)
{
//do something;
}
As sample code, above, I have a method that returns .cshtml view, called ActionMethod2.
I want to use the returned html as a string variable in my action method.How is that possible?
First Mistake is
ActionMethod2return View, And you can get it directly fromMyActionMethodtry this and it will work with you.