DropDownList

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2006
Posts: 62
Reputation: Fenerbahce is an unknown quantity at this point 
Solved Threads: 0
Fenerbahce Fenerbahce is offline Offline
Junior Poster in Training

DropDownList

 
0
  #1
Apr 24th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 9
Reputation: mojio is an unknown quantity at this point 
Solved Threads: 0
mojio's Avatar
mojio mojio is offline Offline
Newbie Poster

Re: DropDownList

 
0
  #2
May 9th, 2006
I guess ...

Dropdownlist could have only one text datafield.

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

  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

^^
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC