Solved

Programatically databinding DropDownList located within a FormView

Posted on 2009-04-02
2
1,094 Views
Last Modified: 2012-05-06
Hello,

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.

Thanks
Anubis.
0
Comment
Question by:Anubis2005
2 Comments
 
LVL 27

Accepted Solution

by:
nmarun earned 500 total points
ID: 24056802
0
 
LVL 1

Author Closing Comment

by:Anubis2005
ID: 31566106
Using the link at aspfree.com mentioned using a HashTable as the datasource for binding and reminded me that I could have done it by calling the data from the db into a hashtable and then binding to the control when I needed.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Output Caching in IIS 2 28
https://github.com/willowsystems/jSignature 11 46
ASP.net File format issue in producing Excel file 3 31
Problem!!! 8 33
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question