regarding drop down lists

T

Tony Jo

Hi
I'm new to ASP.NET and I have recently had trouble with DropDownLists. I am
binding the list using the following code:

DataSet ds = new DataSet();
adapter.Fill (ds,"Table");


availBeds.DataSource = ds.Tables[0];

availBeds.DataTextField =
ds.Tables[0].Columns["bedname"].ColumnName.ToString();

availBeds.DataValueField =
ds.Tables[0].Columns["bid"].ColumnName.ToString();

availBeds.DataBind();

It seems to work fine, but when I try to grab value portion of the list
item, it doesn't seem to work. I even tried storing the value in a temporary
string data type and then displaying it in a label, but the label does not
display anything. I have tried searching for examples, but most sites show
examples using XML or just simply show the basics.

Is there anything that I missed? Any help would be appreciated.

Thanks in advance

Tony
 
D

DalePres

You show all the code except the portion where you are having the problem,
where you "grab value of the list item".

Can you provide more information?

DalePres
 
T

Tony Jo

I wasn't entirely sure on how to do it.
I thought this was the way to do it, as it displayed data in the list when i
tested it. Therefore I just thought that was all the code I needed. Could
you point out what I'm missing?


DalePres said:
You show all the code except the portion where you are having the problem,
where you "grab value of the list item".

Can you provide more information?

DalePres



Tony Jo said:
Hi
I'm new to ASP.NET and I have recently had trouble with DropDownLists. I
am
binding the list using the following code:

DataSet ds = new DataSet();
adapter.Fill (ds,"Table");


availBeds.DataSource = ds.Tables[0];

availBeds.DataTextField =
ds.Tables[0].Columns["bedname"].ColumnName.ToString();

availBeds.DataValueField =
ds.Tables[0].Columns["bid"].ColumnName.ToString();

availBeds.DataBind();

It seems to work fine, but when I try to grab value portion of the list
item, it doesn't seem to work. I even tried storing the value in a
temporary
string data type and then displaying it in a label, but the label does not
display anything. I have tried searching for examples, but most sites show
examples using XML or just simply show the basics.

Is there anything that I missed? Any help would be appreciated.

Thanks in advance

Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,306
Latest member
TeddyWeath

Latest Threads

Top