472,342 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,342 software developers and data experts.

DropDownList SelectedItem Problem

Hi,
I have a problem with a page which has about 50 web controls , 12 of the are
DropDownList.
Also, I have a "Continue" button, and on the server code an event sub
btnContinue_Click, where I process the input data.
There is a code like :

Dim MyVariable As Integer
Dim AnOtherVariable As Integer
MyVariable = DropDownList1.SelectedItem.Value
AnOtherVariable = DropDownList2.SelectedItem.Value

Can anyone help?
Nov 18 '05 #1
4 1651
The Problem is that allways I get 1, that is the first item selected, no
matter wich exactly is selected
"Ivan" <iz*****@hotmail.com> wrote in message
news:er*************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a problem with a page which has about 50 web controls , 12 of the are DropDownList.
Also, I have a "Continue" button, and on the server code an event sub
btnContinue_Click, where I process the input data.
There is a code like :

Dim MyVariable As Integer
Dim AnOtherVariable As Integer
MyVariable = DropDownList1.SelectedItem.Value
AnOtherVariable = DropDownList2.SelectedItem.Value

Can anyone help?

Nov 18 '05 #2
You don't state what the problem is, but judging from the
code sample you provided, I'd say you need to convert the
selected value to an integer.

You'll need something like the following:

MyVar = Integer.Parse(DropDownList1.SelectedItem.Value)
-----Original Message-----
Hi,
I have a problem with a page which has about 50 web controls , 12 of the areDropDownList.
Also, I have a "Continue" button, and on the server code an event subbtnContinue_Click, where I process the input data.
There is a code like :

Dim MyVariable As Integer
Dim AnOtherVariable As Integer
MyVariable = DropDownList1.SelectedItem.Value
AnOtherVariable = DropDownList2.SelectedItem.Value

Can anyone help?
.

Nov 18 '05 #3
Are you populating the drop down lists dynamically? I've
had similar problems when I accidentally put the
population code in the PageLoad event and did not protect
it with a test for IsPostBack.

-Roger
-----Original Message-----
The Problem is that allways I get 1, that is the first item selected, nomatter wich exactly is selected
"Ivan" <iz*****@hotmail.com> wrote in message
news:er*************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a problem with a page which has about 50 web controls , 12 of the
are
DropDownList.
Also, I have a "Continue" button, and on the server

code an event sub btnContinue_Click, where I process the input data.
There is a code like :

Dim MyVariable As Integer
Dim AnOtherVariable As Integer
MyVariable = DropDownList1.SelectedItem.Value
AnOtherVariable = DropDownList2.SelectedItem.Value

Can anyone help?

.

Nov 18 '05 #4

It works now :)
IsPostBack was the problem

Thanks

"R Warford" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
Are you populating the drop down lists dynamically? I've
had similar problems when I accidentally put the
population code in the PageLoad event and did not protect
it with a test for IsPostBack.

-Roger
-----Original Message-----
The Problem is that allways I get 1, that is the first

item selected, no
matter wich exactly is selected
"Ivan" <iz*****@hotmail.com> wrote in message
news:er*************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a problem with a page which has about 50 web controls , 12 of the
are
DropDownList.
Also, I have a "Continue" button, and on the server

code an event sub btnContinue_Click, where I process the input data.
There is a code like :

Dim MyVariable As Integer
Dim AnOtherVariable As Integer
MyVariable = DropDownList1.SelectedItem.Value
AnOtherVariable = DropDownList2.SelectedItem.Value

Can anyone help?

.

Nov 18 '05 #5

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

Similar topics

1
by: DC Gringo | last post by:
I'm having such a problem with this DropDownList in a user control that is posting back and throwing an error: System.Web.HttpException: A...
4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of...
0
by: huobazi | last post by:
I have many dropdownlist controls in my ascx (and use LoadControl in a aspx fiel) file,so i write a method "InitList(DropDownList list,string...
3
by: Randy Armknecht | last post by:
The problem is that when the SelectedIndex is changed, it posts back the page. It does not however fire the OnSelectedIndexChanged event, and it...
10
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ...
1
by: vladp | last post by:
Hi! Here is problem I got. I use vb.net and MSSQL Server 2000. My dropdownlist box gets information from view, and it works. However when I am...
2
by: Antonio D'Ottavio | last post by:
Good morning, I've a problem with a dropdownlist located inside any row of a datalist, I fill both datalist and dropdownlist at runtime, the...
4
by: ^MisterJingo^ | last post by:
Hi all, I have a web page which has a single dropdownlist containing 3 items. Below the dropdownlist are two listboxes. Depending on the option...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.