Binding drop down lists in asp.net

Soldato
Joined
18 Oct 2002
Posts
9,158
Hi, I'm having a play around with asp.net at the mo and in particular DB functionality.

I have however encountered a small issue, I am trying to bind a datasource to a drop down list, but all I am getting is the following:

http://augustus.aces.shu.ac.uk/students/jmbradl3/Default.aspx (check out the drop down list there)

Anyone any ideas what could be going on here?

My code is as follows:

Code:
[size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] employeeAdapter [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] BBBDBTableAdapters.EmployeeTableAdapter

ddlBranch.DataSource = employeeAdapter.GetAllEmployeeData

ddlBranch.DataBind()

[/size]

Thanks in advance,

James
 
That works great, thanks.

What I've done is display the name in the drop down list, how would I go about getting the ID of the employee selected in the drop down box?

Thanks for the help,

Regards,

James
 
That sounds ideal, so would I need something like the followig?


Code:
[size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myInt [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer

[/color][/size][size=2]myInt = Int32.Parse(DropDownList1.SelectedValue)

[/size]
 
Good stuff, I've tried that, check out the website link at the top.


Slight error however, whenever I click the button, which does the command outlined above, I always seem to get the ID of the first name in the box, not whichever one is selected.

Any ideas as to what's going on here.?

Cheers for the help,

James
 
One more quick question; I have a grid control and want to customise the headings and the order by which the columns are displays, any ideas on how I' go about doing this?

Regards,

James
 
Back
Top Bottom