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 "@row.Fastid-@row.Objektsid".

    I have tried

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

    but that won't work. I guess that I have to make @row.Fastid-@row.Objektsid 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 6450 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!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies