Asp – syntax problem in using eval() in a character literal

asp.netevalsyntax

i have a link inside a repeater, and i want to change the url dynamically according to the value inside repeater item.

The problem is when the href value is like this

href='<%# (Boolean.Parse(Eval("HasFile").ToString())==true) ? "www.milliyet.com.tr" : "../Static_Pages_Content.aspx?Parent_ID=Eval("Node_ID")"%>'

I'm gettin a syntax error. And when i directly put the value like '3' instead of Eval("Node_ID") it works correctly. So my problem is probably with the syntax of using eval() in this literal. Any ideas??

Best Answer

Try this:

href='<%# (Boolean.Parse(Eval("HasFile").ToString())==true) ?
  "www.milliyet.com.tr" :
  "../Static_Pages_Content.aspx?Parent_ID=" + Eval("Node_ID") %>'

(new lines for clarity only)