Formatted object title

We often use the title to scroll over for more information.  In this example I was tasked with showing a complete address on scroll over.  I wanted to drop HTML into the title.  I used the MvcHtmlString  and the String Format and the Html.Encode methods to accomplish this.



MvcHtmlString s = MvcHtmlString.Create(String.Format("{0}\n{1}\n{2},{3} {4}", c.division.divisionName, c.division.street, c.division.city, c.division.stateCountry.stateCountryName, c.division.postalCode));


 <li  title='@Html.Raw(Html.Encode(s))'>@c.division.company.companyName</li>
                                       

Comments

Popular posts from this blog

Linq Exclude from separate list

Sorting Ascending and Descending

Ah Blazor - Now refresh the page!