How can data-attributes be set using code behind?
ASP.NET
<asp:Label ID="lbl" runat="server" Text="Value" />
<asp:Panel ID="pnl" runat="server" />
VB
lbl.Text = "Text"
pnl.Attributes("data-attribute") = "200"
//Is this correct?
DESIRED MARKUP
<span id="lbl">Text</span>
<div id="pnl" data-attribute="200">Value</div>
pnl.Attributes("data-attribute") = "200"
C#:
pnl.Attributes["data-attribute"] = "200";
VB:
pnl.Attributes("data-attribute") = "200"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With