eval in if statement?

<% if(Eval("SaveDate") != DBNull.Value){ %> do magic <%} %> gives me error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I could write : <%# Eval(“SaveDate”) != DBNull.Value ? do magic But I need to do lots of html magic in if statement. I … Read more

How to use Single Quotes in Eval Format String

I’ve got a Repeater and its SqlDatasource nested inside a Gridview TemplatedField.
The Repeater’s datasource SelectCommand is set using the FormatString of an Eval from the Gridview.
The SelectCommand has a WHERE clause which is to compare a string.
Because I have already used the single and double quotes, I am having trouble delimiting the string in the SQL WHERE clause.