Dropdown in gridview failing when objectdatasource.FilterExpression is applied.

I ve got a datagrid with 2 dropdownlists in the edit template.
What Im trying to do is to filter the second list based on the selection on the first one.

Both dropdowns are bind to an objectdatasrouce. So when I select an item from the first one, in the 'SelectedIndexChanged' event i doing something like

if list1.selecteditem.text = "WHATEVER" then
     objectdatasource_secondlist.filterexpression = "field=xxx"

But i get this error everytime:
"Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

The second dropdown is bound to field like bind("field").

any ideas??
Who is Participating?
Alfred A.Commented:
And here is one based on two dropdownlist:


And here is one in EE that can help:


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.