Hello everyone how to concat value in .cshtml page.
Loading
Hello everyone how to concat value in .cshtml page.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bhavin NandaniyaPosted Mar 13, 2022, 4:18 PM
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}")
Gajendra JangidPosted Mar 13, 2022, 8:50 AM
RohanPosted Mar 11, 2022, 10:49 AM
RohanPosted Mar 11, 2022, 9:31 AM
RohanPosted Mar 11, 2022, 8:37 AM