mattsonnhalter mattsonnhalter - 1 year ago 101
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>

Answer Source

Did you try:

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


<asp:TextBox ID="DateValue" CssClass='<%# ShowFieldRequired(Eval("Required")) + " calDatePicker"%>' runat="server"></asp:TextBox>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download