html - How to wrap comma separated string onto new line in td cell? -


i've 1 column in table contains comma separated emails in each cell of column.

so example cell may contain following , cell displays email inline. instead of breaking second email onto newline:

jdoe@gmail.com,bgates@outlook.com 

question:

how can wrap comma separated strings onto new line in td cell?

what i've tried:

i can't statically set <br/> between emails being read database dynamically.

i did try adding span within td , applying custom css style wrap-emails. style doesn't display emails stacked expected in cell:

css style:

span.wrap-emails {      word-wrap:break-word  }  

cell definition:

 <td><span class="wrap-emails">@row.contact_emails</span></td> 

you should able replace commas brs using following in razor:

@html.raw(row.contact_emails.replace(",","<br>")) 

the html.raw bit renders br instead of encoding it


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -