Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Blah - I hate stupid error messages. Basically everywhere you look to see what causes this, it has something to do with cacading drop downs. I have ran into this error twice and the fix is - change a “=” to a “#”
if you have in your aspx page
<%= GetMyInfo(Eval("Blah").ToString()) %>
it will throw that error if it is in a repeater or data control. Change it to
<%# GetMyInfo(Eval("Blah").ToString()) %>
and viola! it works :)
Simlar Posts

January 10th, 2007 at 12:20 pm
This is not always the case though. It happens in other situations like binding to data grid caused by another control. One solution I found was disable the view state of that page if you are binding the bound control each time you load the page.
April 5th, 2007 at 2:45 am
Aww man, what a pain.
I’m using a bunch of SqlDataSources in one page (nothing in codebehind). The first SqlDataSource is used as a source for some dropdownlists. If I update this datasource then I receive that error.
September 3rd, 2007 at 6:28 am
everest suggestion is good. EnableViewState=False casuing the problem. then i change to EnableViewState=True now i havent receive the error