I have a controller like this:
public class PreviewController : Controller
{
public ActionResult Index()
{
string name = Request.Form["name"];
string rendering = Request.Form["rendering"];
var information = new InformationClass();
information.name = name;
information.rendering = rendering;
return View(information);
}
}
and in the view, I try to .name information like so:
@ViewBag.information.name
I also tried just:
@information.name
but got the same error for both:
Unable to bind while executing null reference
What am I doing wrong?
source
share