Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Eran Meir 401 posts 543 karma points
    Apr 09, 2011 @ 14:58
    Eran Meir
    0

    newbie problem

    @{

        foreach (var item in Model.Children.Where("Visible && eventDate >= DateTime.Now"))

        { 

            @item.Name

        }

    }

    i'm trying to run this code but i get 

    Error loading Razor Script ListFutureEvents.cshtml
    Incorrect number of parameters supplied for lambda declaration

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Apr 09, 2011 @ 15:06
    Sebastiaan Janssen
    0

    Have you tried Vissible == True && .. ? You might need to make that an explicit compare.

  • Eran Meir 401 posts 543 karma points
    Apr 09, 2011 @ 15:30
    Eran Meir
    0

    changed it and i still get an error, i've tried them alone and both working, but together i get an error.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Apr 09, 2011 @ 15:32
    Sebastiaan Janssen
    0

    Alright, I can't test it right now, but chaining Where statements should work:

    .Where("Visible").Where(eventDate >= DateTime.Now")
  • Eran Meir 401 posts 543 karma points
    Apr 09, 2011 @ 15:35
    Eran Meir
    0

    this way it works thank you, but i'm curious why it won't work the way above

  • Alex 78 posts 136 karma points
    Apr 09, 2011 @ 15:45
    Alex
    1

    I think Gareth confirmed there was a problem with the implementation of "&&" and "||" in 4.7 which has been fixed for 4.7.1

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Apr 09, 2011 @ 17:26
  • Eran Meir 401 posts 543 karma points
    Apr 09, 2011 @ 17:28
    Eran Meir
    1

    awesome, i wish i could mark both answers as the solution, here's high five instead :)

Please Sign in or register to post replies

Write your reply to:

Draft