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

If using a datarepeater and the following gives the above error:

<%  If Eval("VideoFile").ToString() <> "no video" Then%>

I've also tried

<%# DataBinder.Eval(Container.DataItem, "VideoFile") %>

To no avail

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
				
	
	
	
<% If DataBinder.Eval(Container.DataItem, "VideoFile") <> "no video" Then%>
This text will be replaced
<% End If%>
Video Preview

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

yes I have,
<%#ReplaceField(Eval("Description").ToString())%>
and in the code behind
    Protected Function ReplaceField(ByVal stat As String) As String
        'YOUR CUSTOM CODE HERE
        Return "newValue"
    End Function

and if checking for a null or blank record (i.e. don't show image if none there)

<%Response.Write("'  ")%>
Random Solutions  
 
programming4us programming4us