Cannot perform runtime binding on a null reference
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
Source Error:
Line 8: <h2>eBook Of The Day</h2>
Line 9: <div>@ebod.NiceUrl</div>
Line 10: <div>@CurrentPage.Id</div> Line 11: <div class="image-wrapper custom-image-wrapper">
Line 12: <i class="icon-book"></i>
I dont think @CurrentPage should be an issue because I am using it very often. Most like it was introduced in U4.11 (http://our.umbraco.org/documentation/reference/mvc/views)
FYI - I am using MVC views and not umbraco macros.
"Cannot perform runtime binding on a null reference" error from partial views
Hi Community
I am getting following error while using Partial view with @Html.Partial()
Code:
Error:
Here is the exact error message:
Server Error in '/' Application.
Cannot perform runtime binding on a null reference
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
Source Error:
Line 8: <h2>eBook Of The Day</h2> Line 9: <div>@ebod.NiceUrl</div> Line 10: <div>@CurrentPage.Id</div> Line 11: <div class="image-wrapper custom-image-wrapper"> Line 12: <i class="icon-book"></i>
Source File: c:\HostingSpaces\pbdesk\pbdesk.com\wwwroot\Views\Partials\HeroUnits\eBookOfTheDay.cshtml Line: 10
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
hi community ...any help please on this.
Hi Pinal
What version of Umbraco are you using?
/Jan
its Umbraco 4.11.1
Hi Pinal
I suspect it's because there is no @CurrentPage...I must admit that I'm not very fluent at Razor yet but I think you should do this...
var currentPage = @Model;
and then cal the currentPage variable like @currentPage.Id.
Does this help?
/Jan
I dont think @CurrentPage should be an issue because I am using it very often. Most like it was introduced in U4.11 (http://our.umbraco.org/documentation/reference/mvc/views)
FYI - I am using MVC views and not umbraco macros.
@Model does not works with MVC views.
Hi Pinal
Yes, my bad - Having a hard time keeping up with all the nice new stuff we get to explore :) Just stumpled across Shannon's blogpost about it. My bad!
I will try to wrap my head around it and see if I figure something out.
/Jan
Hi Pinal
I think I've been mistaken about the error. Seems to me you're missing () after the NiceUrl() on this line: @ebod.NiceUrl
Try writing: @ebod.NiceUrl()
Does this help? :)
/Jan
Thanks Jan.
Nopes ebod.NiceUrl is also not an issue. I am aware of NiceUrl() issue with 4.11.1.
Btw in above code "ebod" is an object of my custom class "eBook" and I have string property NiceUrl defined in that class.
Hi Community.. any help on this.....
hi all
i am trying to get page using id
and in razor when i call that cshtml file it gives me error any help on this
and without id i can do my stuff
is working on a reply...