473,395 Members | 1,680 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,395 software developers and data experts.

Selected Item On Bound DDL

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
3 1851
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: krzysiek | last post by:
hello, i have several radiolists and checkboxlist that are generated dinamicly based on datasource. So frankly speaking i don't know names and number of that web controls cose they are always...
7
by: Brian Henry | last post by:
I have a list box bound to a data set, of course the datasource,datamember, and valuemember are set, i tell it selecteditem = -1 to make nothing selected, select mode is set to only one item at a...
3
by: Richard Albrecht | last post by:
I have been trying to figure out for days on how to read values from a Bound ListBox. The listBox gets the values from an Access Table. I can read values fine for Non-Bound ListBoxes, But the...
2
by: Brian Henry | last post by:
say I have a databound combo box, which allows for text entry still (DropDownStype = DropDown in this case). now, If the user doesn't enter manually an item in the data bound list, nothing...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
2
by: clickon | last post by:
I am using ASP.net 2.0 and trying to take advantage of the updated data editing facilities provided through the SQLDataSource control and the DetailsView control. The data is a record from a...
2
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a...
0
by: Geary | last post by:
I have a drop down list on an asp.net 2 page that is bound to a table. By default it displays the first item as the selected item. But I want to make sure that the user must change the selection. ...
1
by: sbandalli | last post by:
Hello, I have a Datagridview which has a combobox,and 2 textbox, The combobox is bound to a Datasource(Database Sql Server and the table name is Category) ,and Datagridview is not bounded to any...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.