Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

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?
0
scm0sml
Asked:
scm0sml
  • 3
1 Solution
 
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:
i added it dynamically in the code behind:
txtActionStartDate.Attributes.Add("class", "actionStartDate" + liveLog.ID.ToString());
0
 
scm0smlAuthor Commented:
got my own solution in the end.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now