0

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>
Chitta
  • 185
  • 2
  • 15
  • What are you expecting it to be? (a empty value is effectively `null` and will not be rendered by the razor engine) –  Feb 01 '17 at 10:33
  • @StephenMuecke, Ok so we could not render the value as empty in anyway ? – Chitta Feb 01 '17 at 10:36
  • No, but what would be the point? –  Feb 01 '17 at 10:37
  • point is I am using a third party social sharing plugin and if it is not set or value is null then it is taking some default text. Which I want to avoid. – Chitta Feb 01 '17 at 10:43

0 Answers0