Show a Blog entry on the home page?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
pepper wrote:

This is complete source code
-

getting error with your code

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code

Additional information: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.



Compiler Error Message: CS1061: 'Nop.Web.Models.Blogs.BlogPostModel' does not contain a definition for 'BodyOverview' and no extension method 'BodyOverview' accepting a first argument of type 'Nop.Web.Models.Blogs.BlogPostModel' could be found (are you missing a using directive or an assembly reference?)

Source Error:




Line 67:                         {
Line 68:
Line 69:                             if (!String.IsNullOrEmpty(item.BodyOverview))
Line 70:                             {
Line 71:                                 @Html.Raw(item.BodyOverview)






Hi, I applied this code on nopCommerce 3.7 and its work fine, you can try to run after clean & build your project

or you can use only this code in side post-body div :



@{ counter++;
                        if (counter == 3)
                        {
                        break;
                        }
                        }
                        @Html.Raw(!String.IsNullOrEmpty(item.BodyOverview) ? item.BodyOverview : item.Body)

7 years ago
pepper wrote:

This is complete source code
-

getting error with your code

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code

Additional information: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.



Compiler Error Message: CS1061: 'Nop.Web.Models.Blogs.BlogPostModel' does not contain a definition for 'BodyOverview' and no extension method 'BodyOverview' accepting a first argument of type 'Nop.Web.Models.Blogs.BlogPostModel' could be found (are you missing a using directive or an assembly reference?)

Source Error:




Line 67:                         {
Line 68:
Line 69:                             if (!String.IsNullOrEmpty(item.BodyOverview))
Line 70:                             {
Line 71:                                 @Html.Raw(item.BodyOverview)






Hi, I applied this code on nopCommerce 3.7 and its work fine, you can try to run after clean & build your project

or you can use only this code in side post-body div :



@{ counter++;
                        if (counter == 3)
                        {
                        break;
                        }
                        }
                        @Html.Raw(!String.IsNullOrEmpty(item.BodyOverview) ? item.BodyOverview : item.Body)

7 years ago
can you plz post complete working code again?

anything in controller?
7 years ago
pepper wrote:

This is complete source code
-

getting error with your code

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code

Additional information: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.



Compiler Error Message: CS1061: 'Nop.Web.Models.Blogs.BlogPostModel' does not contain a definition for 'BodyOverview' and no extension method 'BodyOverview' accepting a first argument of type 'Nop.Web.Models.Blogs.BlogPostModel' could be found (are you missing a using directive or an assembly reference?)

Source Error:




Line 67:                         {
Line 68:
Line 69:                             if (!String.IsNullOrEmpty(item.BodyOverview))
Line 70:                             {
Line 71:                                 @Html.Raw(item.BodyOverview)




------------------------------------------------------------
Hi, you can use only this code in side post-body div
------------------------------------------------------------


@{
counter++;
if (counter == 3)
{
  break;
}
}
@Html.Raw(!String.IsNullOrEmpty(item.BodyOverview) ? item.BodyOverview : item.Body)



then clean , build and run
7 years ago
Thanks Jasim, works great! It only breaks my lay-out on the homepage. Will play with the positioning of the code. Probably a div tag that´s breaking things up.
7 years ago
hanzzz wrote:
Thanks Jasim, works great! It only breaks my lay-out on the homepage. Will play with the positioning of the code. Probably a div tag that´s breaking things up.


Hi, can you provide me you site link? if possible then I will try to solve design (css) related problem.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.