using repeater data for a texbox attribute


I have a textbox within a repeater:
<asp:TextBox ID="txtActionStartDate" CssClass="actionStartDate<%#DataBinder.Eval(Container.DataItem, 'ID')%>" runat="server"></asp:TextBox>

Open in new window

As you can see I am trying to set a css class containing a dynamic value.

I'm getting:
The server tag is not well formed.

How can I do this?
Who is Participating?
scm0smlConnect With a Mentor Author Commented:
i added it dynamically in the code behind:
txtActionStartDate.Attributes.Add("class", "actionStartDate" + liveLog.ID.ToString());
Julian HansenCommented:
Try this
<asp:TextBox ID="txtActionStartDate" CssClass="actionStartDate<%=DataBinder.Eval(Container.DataItem, 'ID')%>" runat="server"></asp:TextBox>

Open in new window

scm0smlAuthor Commented:
thats actually rendering the code as text:
 class="actionStartDate<%=DataBinder.Eval(Container.DataItem, 'ID')%>" type="text"
scm0smlAuthor Commented:
got my own solution in the end.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.