Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datasource in a dropdown list

Reply
Thread Tools

Datasource in a dropdown list

 
 
Paul
Guest
Posts: n/a
 
      04-27-2004
Hi

I have a datasource with 1 table, 100 rows, 1 column. I'm trying to
populate the drowndown list with the contents of the datasource,

dd_phys.DataSource = da.ds_phys.Tables("Physical_Office").Rows
dd_phys.DataBind()

but this populates my dropdown list with 100 "SYSTEM.DATA.DATAROW"

I can do the same thing using ths code

For loopy = 0 To da.ds_phys.Tables("Physical_Office").Rows.Count - 1


dd_phys.Items.Add(da.ds_phys.Tables("Physical_Offi ce").Rows(loopy).Item(0))

Next

But I would prefer to get the datasource and databind to work.

Any suggestions?








 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
Guest
Posts: n/a
 
      04-27-2004
Hi, Paul

Try
dd_phys.DataSource = ds_phys
'O
dd_phys.DataSource = ds_phys.Tables("Physical_Office").DefaultVie
dd_phys.DataTextField = "FieldText
dd_phys.DataValueField = "FieldValue
dd_phys.DataBind(

Bin Song, MCP
 
Reply With Quote
 
 
 
 
Scott Hamlin
Guest
Posts: n/a
 
      04-27-2004
I'm not positive, but possibly specifying the fields names that you are
binding to, like so:

lstOrig.DataSource = objDS.Tables("Orig").DefaultView
lstOrig.DataTextField = "Name"
lstOrig.DataValueField = "ID"
lstOrig.DataBind()


"Paul" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi
>
> I have a datasource with 1 table, 100 rows, 1 column. I'm trying to
> populate the drowndown list with the contents of the datasource,
>
> dd_phys.DataSource = da.ds_phys.Tables("Physical_Office").Rows
> dd_phys.DataBind()
>
> but this populates my dropdown list with 100 "SYSTEM.DATA.DATAROW"
>
> I can do the same thing using ths code
>
> For loopy = 0 To da.ds_phys.Tables("Physical_Office").Rows.Count - 1
>
>
>

dd_phys.Items.Add(da.ds_phys.Tables("Physical_Offi ce").Rows(loopy).Item(0))
>
> Next
>
> But I would prefer to get the datasource and databind to work.
>
> Any suggestions?
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AD Datasource for DropDown box =?Utf-8?B?R29uem9v?= ASP .Net 0 11-15-2006 02:37 PM
Can not add to/modify dropdown list after datasource has been load =?Utf-8?B?TWVyZGFhZA==?= ASP .Net 5 11-07-2006 02:32 PM
Getting value of field in dropdown datasource within Formview =?Utf-8?B?VEpIZXJtYW4=?= ASP .Net 0 06-19-2006 06:18 PM
datasource values and dropdown list =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= ASP .Net 0 05-06-2006 03:54 PM
Can not add/modify dropdown liat after datasource has been loaded =?Utf-8?B?TWVyZGFhZA==?= ASP .Net 0 10-20-2004 08:47 PM



Advertisments