Click to See Complete Forum and Search --> : Datalist with user control


trekmp
April 1st, 2004, 07:57 AM
{######### THANKS BUT SORTED IT NOW ##########}
I'll try and explain this clearly and hope I get it right so someone out there may just be able to help.

I've got a datalist bound to a SQL database, which all works fine, till: when I add a user control that I've created, just a simple dropdownlist that display a small list of companies again that comes from an SQL database, the control contains all its own code for getting the companies out of the database., the error I get is

'Specified argument was out of the range of valid values. Parameter name: value ' On this line dlStaffDetails.DataBind()

This happens on the line that tries to bind the data in my .aspx page. The User Control works fine on its own, but fails for me in a datalist.

I think whats its trying to do is bind the usercontrol to the datasource, which it would need to do so I can pass the right information over. If this is the case, I must need to do something else on control, but what I don't know, new to all of this.

-- Background info --
Two tables in the database
Table one stores staff details with numerous fields
Table two stores a list of companies, each with a unique ID, which is then stored in the staff details table when its been selected.

When I then use my datalist with the dropdown in it, I need it to display the staff name(which is does) then select the right company for the right person on the dropdown.

Hope this makes sense.