Copied to clipboard

Flag this post as spam?

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


  • Martin 114 posts 313 karma points
    Feb 15, 2017 @ 08:31
    Martin
    0

    Where() clause with dynamic parameteres

    Hi,

    I have a working static code

    <td>@LedigaNodes.Where("Name == @0", "3-3").First().kommentar</td>
    

    with hardcoded parameter "3-3". However, I need this parameter to be updated from at query dataset as "@[email protected]".

    I have tried

     <td>@LedigaNodes.Where("Name == @0", "@[email protected]").First().kommentar</td>
    

    but that won't work. I guess that I have to make @[email protected] into a string first, but what is the proper way to do that and how should such a string be implemented?

    Thanks for any hints :)

    /martin

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Feb 15, 2017 @ 09:19
    Dennis Adolfi
    0

    Hi Martin.

    You are absolutley right that you need to format your parameters as a string.

    I haven't tried this but you should be able to do like this:

         <td>@LedigaNodes.Where("Name == " + (row.Fastid + "-" + row.Objektsid)).First().kommentar</td>
    

    Let me know how it goes.

    Take care!

Please Sign in or register to post replies

Write your reply to:

Draft