On an .aspx page I need to set the data-attribute on a addthis div. The value is an URL that is calculated in the code behind.
<div class="addthis_sharing_toolbox" data-url="CodeBehindValue"></div>
Is there a way to do this?
On an .aspx page I need to set the data-attribute on a addthis div. The value is an URL that is calculated in the code behind.
<div class="addthis_sharing_toolbox" data-url="CodeBehindValue"></div>
Is there a way to do this?
You have a couple options.
Using a property
<div class="addthis_sharing_toolbox" data-url="<%= PropertyFromCodeBehind %>"></div>
Using a method
<div class="addthis_sharing_toolbox" data-url="<%= MethodFromCodeBehind() %>"></div>
If you choose your div
to run at the server (runat="server"
) such as:
<div id="divMyID" class="addthis_sharing_toolbox" data-url="CodeBehindValue" runat="server"></div>
divMyID.Attributes("data-url") = "http://www.test.com"