makaveli23
New Member
Hi,<BR>I am currently trying to figure out how I can bind a drop down list into a repeater control. All the examples I've been able to find are binding single Data Items.<BR><BR>What I am trying to make is a table which will be dynamically made depending on how many members I have in my group. Each member name will be in a textbox and then the list of roles each member could have would be in a drop down list.<BR>The suggestion to use a repeater came when I was trying to determine how to save the edited data back into my database and how I could assign variables to my text and drop down lists to do so.<BR><BR>But I guess one at a time
<BR>I know how to bind data into a drop down and know how to assign the selected value. I guess I am wondering, how exactly could I code my repeater to use a drop down that is already bound and set and how to individualize them using the repeater?<BR><BR>Thanks for readin and hopefully responding and I hope I haven't jumped around the place too much
You can do multiple binds in your code. When you have bound your data to a databind function you need to close your connection, reopen your connection then perform another bind. I've posted some code that I developed a while back...<BR><BR> mycommand = new sqlcommand("Select * from myaccount",myconnection)<BR> primary_account.datasource = mycommand.executereader()<BR> primary_account.databind() 'getting the primary account information for display and binding it to the page<BR> myconnection.close()<BR><BR> myconnection.open()<BR> mycommand = new sqlcommand("Select * from newaccount",myconnection)<BR> location_fl.datasource = mycommand.executereader()<BR> location_fl.databind() 'getting any Florida information for display and binding it to the page<BR> myconnection.close()<BR><BR><BR>I have about 5 consecutive binds on this page..Hope it helps.Will that work for drop down lists? like I could have:<BR><BR>mycommand = new sqlcommand("Select FullNames from Staff",myconnection)<BR>cboStaffNames.datasource = mycommand.executereader()<BR>cboStaffNames.databind() <BR>myconnection.close()<BR><BR>where as cboStaffNames is an asp drop down list?<BR><BR>My biggest problem is that my load will probably be automatically generating the code.<BR><BR>Aside Question: does the repeater control go through my "data set" or whatever of do i need to do a "for each element in DSStaff"?<BR><BR>Also, is there a way to assign an id to the bound drop down list in relation to what the value of the related text box might be?<BR><BR>Thanks!Yes it will work but you will have to add the additional line after the executereader() statement<BR><BR>cbostaffnames.datatextfield = "fullnames"<BR><BR>Fullnames should be the field name from your datasource.

