Question Bind a single column data obtained from function to dropdownlist for display?

priya.vk1

New member
Joined
Jun 3, 2010
Messages
2
Programming Experience
Beginner
Hi,

I am Priya.

I am working on vb.net.When i try to bind data got from function to dropdownlist, its getting compiled successfully.But, iam unable to view the data.

CbxDisplayProject.DataSource = NewAdmin.getAllProjects()
CbxDisplayProject.DataTextField = "skillname"
CbxDisplayProject.DataValueField = "skillname"
CbxDisplayProject.DataBind()

Then i used displaymember and valuemember as,

CbxDisplaySkills.DataSource = NewAdmin.getAllSkills()
CbxDisplaySkills.DisplayMember = "skillname"
CbxDisplaySkills.ValueMember = "skillname"
CbxDisplaySkills.DataBind()

i am getting error as,
'DisplayMember' is not a member of 'System.Web.UI.WebControls.DropDownList'.
and 'ValueMember' is not a member of 'System.Web.UI.WebControls.DropDownList'.

Can someone help me in this regard?
 
You're confusing a DropDownList and a ComboBox. They both perform essentially the same function but one is an ASP.NET server control and the other is a WinForms control. As such, they have different members. If you're creating a web app then you're using a DropDownList and this thread belongs in the ASP.NET forum.
 
Hi,

this is priya again.

Thanks for the reply.

I tried
CbxDisplaySkills.DataSource = NewAdmin.getAllSkills()
CbxDisplaySkills.DisplayMember = "skillname"

But iam getting same error as:
'DisplayMember' is not a member of 'System.Web.UI.WebControls.DropDownList'.
 
Back
Top