SelectedIndex in DropDownList....Please help, this is driving me crazy.....

  • Thread starter Joe Blanchard via .NET 247
  • Start date
J

Joe Blanchard via .NET 247

Hello,

Can someone please help me. I thought this would be simple but so far nothing I try works.....

I've got a simple update page. On this page I have a datalist bound by data from a SQL Server table. I used the standard:

MyDataList.DataSource = objDS
MyDataList.DataBind()

inside a sub to bind the data on pageload.




In this datalist I have a dropdownlist. All I want to do is have the SelectedIndex of my dropdownlist display the value from the one field (varchar) from the table defined by my SELECT statement.

Nothing I do seems to work. If it helps, I could pull the dropdownlist out of the datalist and bind directly to that if it would be easier. Can someone please lend an ear hear.........

Many thanx
 
E

Eliyahu Goldin

You need to handle ItemDataBound event to set SelectedIndes
programmatically.

Eliyahu

Joe Blanchard via .NET 247 said:
Hello,

Can someone please help me. I thought this would be simple but so far nothing I try works.....

I've got a simple update page. On this page I have a datalist bound by
data from a SQL Server table. I used the standard:
MyDataList.DataSource = objDS
MyDataList.DataBind()

inside a sub to bind the data on pageload.




In this datalist I have a dropdownlist. All I want to do is have the
SelectedIndex of my dropdownlist display the value from the one field
(varchar) from the table defined by my SELECT statement.
Nothing I do seems to work. If it helps, I could pull the dropdownlist out
of the datalist and bind directly to that if it would be easier. Can someone
please lend an ear hear.........
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top