I am moving over from VB to C# and am having problems trying to work out an equivalent in C# for the following razor code (which shows an action link as a button)?
@Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage",
New With {.id = currentItem.CustomerId}, New With {.class = "btn"})
I'm not familiar with VB but it should work when you create anonymous objects like this:
@Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage",
new {id = currentItem.CustomerId}, new { @class = "btn"})
We need @
before class
property because class
is a reserverd word in C#. You may want to read more about anonymous types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With