I\'m wondering how I can apply a CSS class to an ASP.NET Control (TextBox in this case) through the backend in C#. For example:
Simply create an entry in the ViewDataDictionary for the class.
The backend would look something like
ViewData["selectedclass"] = <conditionalstatement> ? "selected" : "";
And the view would be
<asp:TextBox ID="firstName" CssClass="input left <%= ViewData["selectedclass"]%>" runat="server" Text="First Name" />