Simple question and probably simple answer, but I've tried a lot of things.
How can I insert a white space between the 2 values ?
I have tried quotation mark, double quotation mark, removing the ";",  , etc
@if(@providerData.CompanyName != null){
@providerData.CompanyName;WHITESPACE;@providerData.CompanyType;
}
You may use Html.Raw
method to put a white space there
@if(@providerData.CompanyName != null)
{
@[email protected](" ")@providerData.CompanyType
}
Alternatively you can use @:
instead of Html.Raw
@if(@providerData.CompanyName != null)
{
@providerData.CompanyName@: @providerData.CompanyType
}
This is a very old question now, but there's one more possible solution for the problem - use the <text>
tag for this purpose. This tag itself won't be printed to your output but it will preserve the formatting you have inside of it.
@if(@providerData.CompanyName != null)
{
<text>@providerData.CompanyName @providerData.CompanyType</text>
}
I think this way provides the cleanest syntax for what you want to achieve.
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