Hello everyone how to concat value in .cshtml page.
How to concat value in .cshtml page
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Hello everyone how to concat value in .cshtml page.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
RohanRank #1,549 · 1K reputationPosted Mar 11, 2022, 3:37 AM EST
RohanRank #1,549 · 1K reputationPosted Mar 11, 2022, 4:31 AM EST
RohanRank #1,549 · 1K reputationPosted Mar 11, 2022, 5:49 AM EST
Gajendra JangidRank #157 · 14.9K reputationPosted Mar 13, 2022, 4:50 AM EDT
Bhavin Nandaniya160 reputationPosted Mar 13, 2022, 12:18 PM EDT
Use the parentesis syntax:
@(Model.address + " " + Model.city)
or
@(String.Format("{0} {1}", Model.address, Model.city))
With C# 6 you can also use the $-Notation (officially interpolated strings):
@($"{Model.address} {Model.city}")