Last post Oct 17, 2019 09:06 AM by jiadongm
Member
29 Points
127 Posts
Oct 16, 2019 10:03 PM|Baze72|LINK
How can I add text ( - ) in front of the ticket.Phone. So I want the display to be - 555-5555 instead of 555-5555.
<td>@ticket.RequestedBy @if (ticket.Phone != null) { @ticket.Phone}</td>
Thanks,
EB
All-Star
52971 Points
23574 Posts
Oct 16, 2019 10:43 PM|mgebhard|LINK
Use HTML.
<td> @ticket.RequestedBy @if (ticket.Phone != null) { <span>-</span> @ticket.Phone } </td>
Oct 17, 2019 01:48 AM|Baze72|LINK
mgebhard Use HTML. <td> @ticket.RequestedBy @if (ticket.Phone != null) { <span>-</span> @ticket.Phone } </td>
I figured it would be easy!
one quick question: the - shows up even if Ticket.Phone is null. Why would that be?
Participant
1320 Points
491 Posts
Oct 17, 2019 09:06 AM|jiadongm|LINK
Hi Baze72,
Baze72 the - shows up even if Ticket.Phone is null.
What does the "null" mean? Ticket.Phone = null or Ticket.Phone = "" ? For these two conditions, you can use string.IsNullOrEmpty().
<td> @ticket.RequestedBy @if (!string.IsNullOrEmpty(ticket.Phone)) { <span>-</span> @ticket.Phone } </td>
If this is not the case, could you please show us an example?
Best Regards,
Jiadong Meng
Member
29 Points
127 Posts
Mix text and funtion inside a If statement
Oct 16, 2019 10:03 PM|Baze72|LINK
How can I add text ( - ) in front of the ticket.Phone. So I want the display to be - 555-5555 instead of 555-5555.
Thanks,
EB
All-Star
52971 Points
23574 Posts
Re: Mix text and funtion inside a If statement
Oct 16, 2019 10:43 PM|mgebhard|LINK
Use HTML.
Member
29 Points
127 Posts
Re: Mix text and funtion inside a If statement
Oct 17, 2019 01:48 AM|Baze72|LINK
I figured it would be easy!
one quick question: the - shows up even if Ticket.Phone is null. Why would that be?
Participant
1320 Points
491 Posts
Re: Mix text and funtion inside a If statement
Oct 17, 2019 09:06 AM|jiadongm|LINK
Hi Baze72,
What does the "null" mean? Ticket.Phone = null or Ticket.Phone = "" ? For these two conditions, you can use string.IsNullOrEmpty().
<td> @ticket.RequestedBy @if (!string.IsNullOrEmpty(ticket.Phone)) { <span>-</span> @ticket.Phone } </td>
If this is not the case, could you please show us an example?
Best Regards,
Jiadong Meng