Programatically databinding DropDownList located within a FormView
Posted on 2009-04-02
I have a FormView which has a DropDownList located within it. I am needing to set the List's DataBinding programatically (I've seen ways to do it non-programatically, but none solved my requirements) and the problem I'm encountering is, when I'm performing my programming in the OnDataBound event of the FormView:
"There is already an open DataReader associated with this Command which must be closed first."
I don't want to enable multiple open DataReaders on my connection so I'm trying to find another way around it.
I tried putting the databinding in the OnPageLoad event but when I tried to call FormView.FindControl("MyDropDown") it returned null.