web analytics

Adding HTML attributes to ASP.NET CheckBox

Options

codeling 1595 - 6639
@2024-01-13 08:46:45

In an ASP.NET page, to dynamically add the HTML attributes such as aria-required to the input elements like checkbox, you can do this in the code:

myCheckBox.InputAttributes.Add("aria-required", "true");

Then the CheckBox are usually rendered like this:

Renders as:

<input type="checkbox" aria-required="true" />

 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com