mattsonnhalter mattsonnhalter - 8 months ago 71
ASP.NET (C#) Question

ASP Textbox CSS and Data Binding Expression Issue

I have an ASP Textbox and I'm trying to add the style calDatePicker along with a databinding expression within the same CssClass attribute.

Below is an example of the code I am trying to get to work. Any ideas?

<asp:TextBox ID="DateValue" CssClass='<%# ShowFieldRequired(Eval("Required"))%> + "calDatePicker"' runat="server"></asp:TextBox>


Did you try:

CssClass='<%# ShowFieldRequired(Eval("Required"))%> calDatePicker' 


<asp:TextBox ID="DateValue" CssClass='<%# ShowFieldRequired(Eval("Required")) + " calDatePicker"%>' runat="server"></asp:TextBox>