Pages

Search This Blog

Monday, August 11, 2008

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Server Error in '/xxxxx' Application.

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.            

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Source Error:

Line 89: <%# if (Eval("UserId").ToString().Length != 0) {%>


googling around and not able to find a solution. What i do is i put the if/else condition into a function and pass in UserId as parameter and output the desire output string.

now my line 89: become <%# FormatRatedDisplay(Eval("UserId").ToString())%> and new function FormatRatedDisplay will return a string. I issue solved.

No comments: