KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following structure: Controller.cs public ActionResult PageMain(string param) { return View(); } PageMain.cs namespace project1.Models { public class PageMain { public DataTable dtable { get { // some code that returns a DataTable } } } } and finally in the view: @using project1.Models @model PageMain var datatable = Model.dtable // but this is throwing an error since the model is null Does anyone know why my model is returning null? How can I access the datatable in the PageMain.cs? I am new to MVC so if I have any logical error in the structure please do not hesitate in warning me :)
Tags (comma-separated)
Save Edits
Cancel