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

dropdown list not keeping selection

I have a dropdown list box and a button on a web form, the autopost back is
false for the dropdown list box and button. When the button is pushed the
selection in the dropdownlist box is lost, just wondering what is wrong.

Selected value is always 1 no matter what is selected in the dropdown list
box.

Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_yes.Click
Dim s_origidval As String
s_origidval = Me.dr_orig.SelectedValue
End SubThanks
--
Paul G
Software engineer.
Nov 19 '05 #1
4 4569
You did not provide enough code to diagnose the problem. First guess would
be that you are repopulating the dropdown in page_load every time, instead
of just the first.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
I have a dropdown list box and a button on a web form, the autopost back is
false for the dropdown list box and button. When the button is pushed the
selection in the dropdownlist box is lost, just wondering what is wrong.

Selected value is always 1 no matter what is selected in the dropdown list
box.

Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_yes.Click
Dim s_origidval As String
s_origidval = Me.dr_orig.SelectedValue
End SubThanks
--
Paul G
Software engineer.

Nov 19 '05 #2
thanks for the response, yep forgot to include
if Not Page.IsPostBack
in the page load
"Marina" wrote:
You did not provide enough code to diagnose the problem. First guess would
be that you are repopulating the dropdown in page_load every time, instead
of just the first.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
I have a dropdown list box and a button on a web form, the autopost back is
false for the dropdown list box and button. When the button is pushed the
selection in the dropdownlist box is lost, just wondering what is wrong.

Selected value is always 1 no matter what is selected in the dropdown list
box.

Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_yes.Click
Dim s_origidval As String
s_origidval = Me.dr_orig.SelectedValue
End SubThanks
--
Paul G
Software engineer.


Nov 19 '05 #3
Did you set value for each ListItem? There are Text and Value properties for
each ListItem. What does Items of ListBox property look like which contain
all ListItems.

Shaw
"Paul" wrote:
thanks for the response, yep forgot to include
if Not Page.IsPostBack
in the page load
"Marina" wrote:
You did not provide enough code to diagnose the problem. First guess would
be that you are repopulating the dropdown in page_load every time, instead
of just the first.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
I have a dropdown list box and a button on a web form, the autopost back is
false for the dropdown list box and button. When the button is pushed the
selection in the dropdownlist box is lost, just wondering what is wrong.

Selected value is always 1 no matter what is selected in the dropdown list
box.

Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_yes.Click
Dim s_origidval As String
s_origidval = Me.dr_orig.SelectedValue
End SubThanks
--
Paul G
Software engineer.


Nov 19 '05 #4
Yep, populating the listbox with a dataset, and then in the code binding the
control
Me.dropdown.DataBind() 'bind data to drop down list.
I also have the datasource set to the dataset in the properties box of the
dropdown list box, seems to be working now.

"Shaw" wrote:
Did you set value for each ListItem? There are Text and Value properties for
each ListItem. What does Items of ListBox property look like which contain
all ListItems.

Shaw
"Paul" wrote:
thanks for the response, yep forgot to include
if Not Page.IsPostBack
in the page load
"Marina" wrote:
You did not provide enough code to diagnose the problem. First guess would
be that you are repopulating the dropdown in page_load every time, instead
of just the first.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
>I have a dropdown list box and a button on a web form, the autopost back is
> false for the dropdown list box and button. When the button is pushed the
> selection in the dropdownlist box is lost, just wondering what is wrong.
>
> Selected value is always 1 no matter what is selected in the dropdown list
> box.
>
> Private Sub btn_yes_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btn_yes.Click
> Dim s_origidval As String
> s_origidval = Me.dr_orig.SelectedValue
> End SubThanks
> --
> Paul G
> Software engineer.

Nov 19 '05 #5

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

Similar topics

1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
10
by: JL | last post by:
Does anyone have any ideas on this please? I don't know how to evaluate the no-blank selections against each other from a form as follows: . I have a form with 6 dropdown fields, each...
4
by: anonymous | last post by:
Hi Folks, I have a form with two Dropdown list boxes, which get loaded with data from Database. DropDownList1 gets data from Table1 and DropDownList2 gets data from Table2 Table1 has a...
0
by: Jeff | last post by:
After I bind the repeater control in the form_load event, it builds multiple lines based on the number of rows in the dataset. In the repeater control, I have a textbox and a dropdown list box. ...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
1
by: Vijay Kerji | last post by:
Hi, I have a datagrid with dropdown list and Remove hyperlink in it as columns. When I remove a row from the datagrid, Dropdown list selection is retaining its previous value. i.e, removed...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
3
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in...
3
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.