Wow! That was great; I gave you a direct question and you gave me a direct
and effective response. The application works: All is love; all is peace;
all is harmony.
--
Derek V. Taylor
UCI Brain Imaging Center
"Steve C. Orr [MVP, MCSD]" wrote:
[color=blue]
> You may want to ensure you're binding only on the initial page load and not
> on each postback, which could effectively overwrite the user's selection.
> Here's an example:
>
> 'Page_Load event...
> If Not Page.IsPostBack() Then
> ListBoxStudies.DataSource = BICDataSet.Tables("protocols")
> ListBoxStudies.DataTextField = "Study_name"
> ListBoxStudies.DataValueField = "irb_number"
> ListBoxStudies.DataBind()
> End If
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
>
http://SteveOrr.net
>
>
> "Derek Vincent" <DerekVincent@discussions.microsoft.com> wrote in message
> news:E28B3B1C-7698-4B20-BB19-31D1DEA14775@microsoft.com...[color=green]
> > Using Visual Studio.net 2003 to create an aspx web form I am having a
> > problem selecting an item from DropDownListBox with id= ListBoxStudies.
> > I can see the items from the bound database table but when I click on an
> > item
> > the selected item stays at itemindex 0. What must I do to have the
> > itemindex change when I click on an item. What's missing from the
> > following
> > code?
> >
> >
> > ListBoxStudies.DataSource = BICDataSet.Tables("protocols")
> > ListBoxStudies.DataTextField = "Study_name"
> > ListBoxStudies.DataValueField = "irb_number"
> > ListBoxStudies.DataBind()
> >
> >
> > I have tested this using a submit button and the _SelectedIndexchanged
> > event
> > and I still always get selectedindex = 0.
> >
> > Private Sub DropDownListStudies_SelectedIndexChanged(ByVal sender As
> > System.Object, ByVal e As System.EventArgs)
> > Dim study_name As String = Session("study_name")
> > study_name = ListboxStudies.SelectedItem.Text
> > End Sub
> >
> > --
> > Derek V. Taylor
> > UCI Brain Imaging Center[/color]
>
>
>[/color]