Eval doesn't work

Mateusz Żebrowski asked on June 22, 2014 17:11

Ok I've got problem with Eval function in document type transformation. I created document Type called "Poem". After that I added three custom fields - I mean I clicked on green plus button titled "Add Attribute" in "Fields". Those fields are "Author" "Title" and "Text". And then wrote the transformation as follow:

    <p>Poem written by <%# Eval("Author") %> titled <%# Eval("Title") %></p>
    <a href="<%# GetDocumentUrl() %>"> Read it NOW!!!</a>

Then I created page with document data source and basic repeater, add under it two poems and all I get is:

Poem written by titled

Read it NOW!!!

Poem written by titled

Read it NOW!!!

The links are good (I'm sure) but I can't see Author and Title. What's wrong?

Recent Answers


Filip Ligač answered on June 23, 2014 03:23 (last edited on June 23, 2014 03:25)

Hello Mateusz,

Are you sure you use ASCX transformation? The thing is Eval method can only be used in this type of transformation.

In case of Text / XML transformations, you can use e.g. {% Author %} directly.

Also, are those fields standard Text boxes or have you used any other form control?

0 votesVote for this answer Mark as a Correct answer

Mateusz Żebrowski answered on June 23, 2014 05:39

I'm Sure this is ASCX transformation. Author and Title are standard text boxes and I didn't used my own form controls (what if I were?). If my problem description is not clear I can write what I did step by step. It's strange for me too.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 23, 2014 07:14

Check the event log for more details. Are you sure the field name is "Author" or "Title"? You have to use the actual column/field name and not the caption. Also, what types of fields are they (int, text, etc.) and what is the control you're using for each field (textbox, WYSIWYG editor, etc.)?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.