Search code examples
c#data-bindingbindingrepeater

Databinding Repeater Issue


Im trying to bind My query to two items in my default page. I think the DataBinder.Eval should be in blue also. Its not. Can you tell me what im doing wrong in the code below. Im getting a sintax error that says.

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Server tags cannot contain <% ... %> constructs.

Default.aspx

<asp:Label ID="lblCommenter" runat="server" Text="<%DataBinder.Eval(Container.DataItem,"CommentersName") %>"></asp:Label>

Code Behind

 BSComments GetComments = new BSComments();
 DataTable DAGetComments = GetComments.GetCommentsByPicIDs(PicId);
 Repeater1.DataSource = DAGetComments;
 Repeater1.DataBind();

Solution

  • Try this:

    Text='<% #Eval("CommentersName") %>'