CsharpBeginner
CsharpBeginner

Reputation: 1773

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();

Upvotes: 0

Views: 343

Answers (2)

DennisZhong
DennisZhong

Reputation: 410

try use

Text='<%DataBinder.Eval(Container.DataItem,"CommentersName") %>'

Notice the ' and ", what we do in javascript

Upvotes: 1

Nick Bray
Nick Bray

Reputation: 1963

Try this:

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

Upvotes: 1

Related Questions