By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Selected Item On Bound DDL

P: n/a
Does anyone know how to Make an Item selected in a DropDownListBox when
Binding it to data. When it changes it populates another TextBox but the
DDLB does not retain it's selected value.

Thanks

Randy
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ben
Don't rebind the control during selected index changed. If you must, store
the selected value, rebind it, then reapply the selected value.
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Does anyone know how to Make an Item selected in a DropDownListBox when
Binding it to data. When it changes it populates another TextBox but the
DDLB does not retain it's selected value.

Thanks

Randy


Nov 18 '05 #2

P: n/a
Still Not working.. Here is some code:
Sub Page_Load

If Not IsPostBack Then

lblNotes.Visible = True
txtNotes.Visible = False
btnUpdateNotes.Visible = False

Else
Session("ItemSel") = ddlItem.SelectedItem.Value
ddlItem.SelectedItem.Value = Session("ItemSel")
ddlItem.SelectedItem.Selected = True
End If
End Sub
"Ben" <be*@online.nospam> wrote in message
news:89*************@fe37.usenetserver.com...
Don't rebind the control during selected index changed. If you must, store the selected value, rebind it, then reapply the selected value.
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Does anyone know how to Make an Item selected in a DropDownListBox when
Binding it to data. When it changes it populates another TextBox but the
DDLB does not retain it's selected value.

Thanks

Randy


Nov 18 '05 #3

P: n/a
See comment inline

"Randy Rubin" <ra***@imarubin.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
Still Not working.. Here is some code:
Sub Page_Load

If Not IsPostBack Then

lblNotes.Visible = True
txtNotes.Visible = False
btnUpdateNotes.Visible = False

Else
I think you should move the first line of code below to
ddlItem_SelectedIndexChanged event handler and erase the other two lines,
UNLESS you really want to ddlItem's selected item change to something else
other than user clicked item.
Session("ItemSel") = ddlItem.SelectedItem.Value
ddlItem.SelectedItem.Value = Session("ItemSel")
ddlItem.SelectedItem.Selected = True
End If
End Sub
"Ben" <be*@online.nospam> wrote in message
news:89*************@fe37.usenetserver.com...
Don't rebind the control during selected index changed. If you must,

store
the selected value, rebind it, then reapply the selected value.
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Does anyone know how to Make an Item selected in a DropDownListBox when Binding it to data. When it changes it populates another TextBox but the DDLB does not retain it's selected value.

Thanks

Randy



Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.