Can some please help explain something? I’m messing around with surface controllers and i'm clearing missing something.
I have the following Homepage razor view which has a bunch of partial defined and one html.action call.
The Html.Action calls the following custom controller which I have defined
At this point all the controller does is make a call to the following partial
If I call the partial directly from the home page then the Model.Content is available. However, if i call it from the controller i get the Model is null.
Model object is null question
Hi all,
Can some please help explain something? I’m messing around with surface controllers and i'm clearing missing something.
I have the following Homepage razor view which has a bunch of partial defined and one html.action call.
The Html.Action calls the following custom controller which I have defined
At this point all the controller does is make a call to the following partial
If I call the partial directly from the home page then the Model.Content is available. However, if i call it from the controller i get the Model is null.
What do i need to do?
Paul
Hi Paul,
I think the problem is that you are not passing your model to your view in your action.
You can do this in our action :
And then your first line in your view should be :
Now your model in your view is the content item of the testimonialpage.
Dave
PS : I'm writing this from the train without testing, so there can be some syntax errors
Dave
Hi Dave,
Thanks very much for responding. It makes sense what you are saying.
Ill have have a play around and see if i can get it working :)
Will let you know
Paul
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.