using repeater data for a texbox attribute

Hi,

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?
scm0smlAsked:
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());
0
 
Julian HansenCommented:
Try this
<asp:TextBox ID="txtActionStartDate" CssClass="actionStartDate<%=DataBinder.Eval(Container.DataItem, 'ID')%>" runat="server"></asp:TextBox>

Open in new window

0
 
scm0smlAuthor Commented:
thats actually rendering the code as text:
 class="actionStartDate<%=DataBinder.Eval(Container.DataItem, 'ID')%>" type="text"
0
 
scm0smlAuthor Commented:
got my own solution in the end.
0
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.