944,043 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2705
  • ASP.NET RSS
Apr 24th, 2006
0

DropDownList

Expand Post »
hi,
sorgu = New SqlCommand("SELECT name, surname, age FROM veriler WHERE name=@name", database)
sorgu.Parameters.AddWithValue("@name", DropDownList1.Text)

name surname and age are rows in one of columns. i cant add them into the DropDownList.

DropDownList2.DataSource = kisiler
DropDownList2.DataTextField = "name"
DropDownList2.DataTextField = "surname"
DropDownList2.DataTextField = "age"
DropDownList2.DataBind()

this line add only "age". i want it to add all.

thank you
Similar Threads
Reputation Points: 15
Solved Threads: 0
Junior Poster in Training
Fenerbahce is offline Offline
62 posts
since Apr 2006
May 9th, 2006
0

Re: DropDownList

I guess ...

Dropdownlist could have only one text datafield.

Your sql command have 3 columns in one row not one column
name | surname | age
ASP.NET Syntax (Toggle Plain Text)
  1. sorgu = New SqlCommand("SELECT name, surname, age FROM veriler WHERE name=@name", database)

ASP.NET Syntax (Toggle Plain Text)
  1. DropDownList2.DataSource = kisiler
  2. DropDownList2.DataTextField = "name"
  3. DropDownList2.DataTextField = "surname"
  4. DropDownList2.DataTextField = "age"
  5. DropDownList2.DataBind()

first line you put the value in field name in datatextfield
second line you put the value in field surname in datatextfield
and the last you put the value in field age in datatextfield

so your field age show in dropdownlist

^^
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mojio is offline Offline
9 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: DataTable
Next Thread in ASP.NET Forum Timeline: please help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC