Reputation: 409
Here's may Html helper:
@Html.ActionLink("CONTACT THE USER ABOUT THIS LISTING", "create", "contactform", new { recipientID = Model.User.Id, productid = Model.Product.ID }, null)
What I would like to do is:
@Html.ActionLink("CONTACT " Model.UserName " ABOUT THIS LISTING", "create", "contactform", new { recipientID = Model.User.Id, productid = Model.Product.ID }, null)
Can it be done?
Upvotes: 0
Views: 1767
Reputation: 11681
@Html.ActionLink($"CONTACT {Model.UserName} ABOUT THIS LISTING", "create", "contactform", new { recipientID = Model.User.Id, productid = Model.Product.ID }, null)
Upvotes: 0
Reputation: 5260
Yes, just use standard string concantenation.
@Html.ActionLink("CONTACT " + Model.UserName + " ABOUT THIS LISTING", "create", "contactform", new { recipientID = Model.User.Id, productid = Model.Product.ID }, null)
Upvotes: 0
Reputation: 219047
You can use the +
operator to concatenate string values in C#:
"CONTACT " + Model.UserName + " ABOUT THIS LISTING"
Or something like string.Format()
instead:
string.Format("CONTACT {0} ABOUT THIS LISTING", Model.UserName)
Upvotes: 1