@if (Product.Count < 0)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 11 años
Good Morning All,

I am currently developing a new Category.Template.

I have Inserted the record in to database and added the nessercary content I need in the Non Action Method. PrepareProductOverviewModel to display new feild's of Data.

I have removed the subcategory view from the template and require the

@Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })

and
@Html.Action("HomePageNews", "News")


To remain untill the user navigate's to the Product List.

In the template I have the following code



@if (Model.Products.Count < 0)
{
    @Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })
    <div class="clear">
    </div>
    @Html.Action("HomePageNews", "News")
}
    
@*product list*@
    @if (Model.Products.Count > 0)
    {
        if (Model.PagingFilteringContext.ViewMode == "list")
        {

            if (Model.DisplayCategoryBreadcrumb)
            {


As we can see highlighted in bold I have wrote an If statement that declares that if the Product.Count is less than 0 then the the Html.Action's below should remain. There not. My question is

1. Can anyone advise me on what I am currently missing and where to make the nesercary change.

Thank you All

Richard
Hace 11 años
what happens when Model.Products.Count == 0 ? because you're testing less than zero and more than zero, so when Product.Count == 0 nothing should be shown?
Hace 11 años
Hi Keesjan

Yes that works Btw upadated accordingly


@if (Model.Products.Count == 0)
{
    @Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })
    <div class="clear">
    </div>
    @Html.Action("HomePageNews", "News")
}
    @*product list*@
    @if (Model.Products.Count > 0)
{


The Html action's return's when navigating through the Categories until I reach the product list which just display's the products

Thank you Kindly

Richard.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.