TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jonathan Sheed
NA
3
0
C #Working with Dropdown lists
Oct 16 2008 8:49 AM
Hi there,
I'm net to C#, .net, visual studio, so please excuse me if my questions are a little stupid.
I am trying to create a webform and am confused as to how the data is collected from a Dropdown list.
The code I have is;
protected void Page_Load(object sender, EventArgs e)
{
string strConn = "Data Source=test-sql-01;Initial Catalog=IEG4; User ID=; Password=";
SqlConnection conn = new SqlConnection(strConn);
SqlDataAdapter daStatus = new SqlDataAdapter("select [Status] from [Council Tax Status]", conn);
DataSet dsStatus = new DataSet();
daStatus.Fill(dsStatus);
lstStatus.DataSource = dsStatus;
lstStatus.DataTextField = "Status";
lstStatus.DataBind();
}
protected void lstStatus_SelectedIndexChanged(object sender, EventArgs e)
{
lblStatus.Text = lstStatus.SelectedValue;
}
When the value selected in the Dropdown box is changed the text value of the label does not change
Can anyone point me in the right direction?
Thanks
Reply
Answers (
2
)
C# Automaticly enter text into html forms
Query on collections