I was curious about how I could dynamically apply a CSS class to an ASP.NET Control (specifically a TextBox) through C# on the backend. For instance:
<asp:TextBox ID="firstName" CssClass="input left" runat="server" Text="First Name" />
I want to add another class "selected" to the element if a certain condition is met in the backend code.
<asp:TextBox ID="firstName" CssClass="input left selected" runat="server" Text="First Name" />
Can someone advise me on the best approach for achieving this? Much appreciated!