473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>aCdp5BY3C0qbRCU9A/dLOQ==</Id>
Nov 19 '05 #1
1 1397
You need to handle ItemDataBound event to set SelectedIndes
programmatically.

Eliyahu

"Joe Blanchard via .NET 247" <an*******@dotnet247.com> wrote in message
news:uO**************@tk2msftngp13.phx.gbl...
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

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>aCdp5BY3C0qbRCU9A/dLOQ==</Id>

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: tfs | last post by:
I have a dropdownlist that I was setting to an index (which happened to be the same as the value). I changed this to a character as that is what I want to have in my database. <asp:dropdownlist...
5
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
3
by: Nathan Sokalski | last post by:
I am working on a simple user control composed of 3 DropDownLists that will be used to select Dates. The purpose of the control is to all the user to choose a date using dropdown lists but not need...
1
by: Nathan Sokalski | last post by:
I have a problem that is driving me crazy. I have a User Control composed of three DropDownLists that will be used to select a date. I have everything working except for one thing. When I select a...
6
by: Nathan Sokalski | last post by:
I am writing a User Control that uses 3 DropDownLists. When I attempt to access the SelectedIndex property it incorrectly reports the value selected by the user. Why is this? Here is my code,...
2
by: 23s | last post by:
I have a dropdown bound to a dataview. The binding assigns the dropdown with a SelectedIndex of 0. There is a msgbox in the SelectedIndexChanged event that displays the SelectedIndex property....
1
by: pleaseexplaintome | last post by:
Hi all, I have a datagrid with a dropdownlist and would like to have the dropdownlist display a database value correctly while the grid is in edit mode. I have a templatecolumn as follows: ...
1
by: marcbb | last post by:
Hi all, I have a really strange problem working with Dropdownlists in a DataGrid. I'm trying to preselect some values from the DropDownlist for each row in the DataGrid, but it seems that...
3
by: S_K | last post by:
Hi, I have a list of 6 DropDownList boxes, from DropDownList1 to DropDownList6, and I'm changing the SelectedIndex of each using a foreach loop as follows: foreach(PaymentReqDisplay...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.