Custom MVC htmlhelper not rendering correctly

28 Views Asked by At

I Have a HtmlHelper code like below

 sskIconsHtml +=
                    "<a href=\"#\" class=\"ssk ssk-twitter social-icon si-borderless si-text-color si-twitter\" title=\"Twitter\"";
                sskIconsHtml += (socialSharing != null && !string.IsNullOrEmpty(socialSharing.TwitterShortenedUrl))
                    ? " data-url=\"" + socialSharing.TwitterShortenedUrl + "\""
                    : string.Empty;
                sskIconsHtml += " data-text=''";
                sskIconsHtml += (socialSharing != null && !string.IsNullOrEmpty(socialSharing.TwitterText))
                    ? " data-title=\"" + socialSharing.TwitterText + "\""
                    : string.Empty;
                sskIconsHtml +=
                   " ><i class=\"icon-twitter\"></i><i class=\"icon-twitter\"></i></a>";

If you see the data-text I am passing a value of empty string But where it rendered in the browser it is rendering like below see the data-text property.

<a href="#" class="ssk ssk-twitter social-icon si-borderless si-text-color si-twitter" title="Twitter" data-text data-title="What is Electro" data-ssk-ready="true"><i class="icon-twitter"></i><i class="icon-twitter"></i></a>
0

There are 0 best solutions below