Hi!
I have an .aspx with some controls that are created dynamically. The
items are populated into the box by setting the DataSource-property to
a list. In addition I specify the text and value with DataTextField
and DataValueField; this works as expected.
However, my problems arises when I want to read the selected value
(i.e. after a postback caused by a change in the DropDown), the
selected item is always the first item in the DropDown. I do call the
DataBind-method, I believe that this might cause this.
My idea is to parse the selected value for a pattern and perform
operations on background of what this contains.
Anyone who know how to accomplish this?
Regards,
Ronny Mandal 4 2498
Are you repopulating the DropDown after the the postBack? You may be
having an issue where the drop down isn't populated yet when you are
reading the selected item.
On Oct 11, 12:25 pm, Ronny Mandal <ronn...@math.uio.nowrote:
Hi!
I have an .aspx with some controls that are created dynamically. The
items are populated into the box by setting the DataSource-property to
a list. In addition I specify the text and value with DataTextField
and DataValueField; this works as expected.
However, my problems arises when I want to read the selected value
(i.e. after a postback caused by a change in the DropDown), the
selected item is always the first item in the DropDown. I do call the
DataBind-method, I believe that this might cause this.
My idea is to parse the selected value for a pattern and perform
operations on background of what this contains.
Anyone who know how to accomplish this?
Regards,
Ronny Mandal
On Oct 11, 6:29 pm, MDoyle <MatthewRDo...@gmail.comwrote:
Are you repopulating the DropDown after the the postBack? You may be
having an issue where the drop down isn't populated yet when you are
reading the selected item.
Yes, I am populating after the post-back. But if the the drop down
isn't populated,
how come that I always get the first item when I get the current
selected?
Regards,
Ronny Mandal
You will always get the first item, if you don't enclose the population of
the DDL inside an if/then/postback block
if not page.ispostback then
- - populate ddl
end if
David Wier http://aspnet101.com http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Ronny Mandal" <ro*****@math.uio.nowrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
On Oct 11, 6:29 pm, MDoyle <MatthewRDo...@gmail.comwrote:
>Are you repopulating the DropDown after the the postBack? You may be having an issue where the drop down isn't populated yet when you are reading the selected item.
Yes, I am populating after the post-back. But if the the drop down
isn't populated,
how come that I always get the first item when I get the current
selected?
Regards,
Ronny Mandal
this method requires Viewstate to be turned on (bad idea). just recreate
the dropdown in OnInit, then the databind will be before the postback
data load event.
-- bruce (sqlwork.com)
David Wier wrote:
You will always get the first item, if you don't enclose the population of
the DDL inside an if/then/postback block
if not page.ispostback then
- - populate ddl
end if
David Wier http://aspnet101.com http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Ronny Mandal" <ro*****@math.uio.nowrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
>On Oct 11, 6:29 pm, MDoyle <MatthewRDo...@gmail.comwrote:
>>Are you repopulating the DropDown after the the postBack? You may be having an issue where the drop down isn't populated yet when you are reading the selected item.
Yes, I am populating after the post-back. But if the the drop down isn't populated, how come that I always get the first item when I get the current selected?
Regards,
Ronny Mandal
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Melissa |
last post by:
Hi all,
I am trying to retrieve data from a dropdown listbox in asp using:
<%Response.Write + Request.Form("cboBox")%>
The problem is that I only retrieve the first value of the option. For...
|
by: olle |
last post by:
Hi folks.
I learning asp.net and compare it with traditional asp and
Access-developing.
The issue is this one:
1/I have this Ms Acceess adp-project application that works fine on my
Ms Sql...
|
by: Howard, Brett |
last post by:
I am binding data to the <ASP:Dropdown> object. My field that I am binding
to the DataTextField property has " " in the data out of the database.
The problem that I am having is that when the...
|
by: Paul Eason |
last post by:
I have identified a re-creatable issue that may be a bug
and may be by design?
I have a Webform with two dropdown lists on it, each with
a different name and different tab index but they both...
|
by: Neo |
last post by:
Hello All,
This one has me stumped, but before going to write a code, i want to be
sure of the solution.
I have a asp:radiobutton group on a page, and on click of any of the
radiobutton, i...
|
by: delfion |
last post by:
Hi.
I have an <asp:dropdown> control to which I add items on the client, when the
page is posted back I get this error message.
Invalid postback or callback argument.
Event validation is...
|
by: Ronny Mandal |
last post by:
Hi!
I have an .aspx with some controls that are created dynamically. The
items are populated into the box by setting the DataSource-property to
a list. In addition I specify the text and value...
|
by: soni2926 |
last post by:
hi,
i have a asp:dropwdown list on my page, it's populated with data (via
a dataset) on page_load. when a user selects a choice i want to call
a javascript function, is this possible? to have a...
|
by: fran7 |
last post by:
Hi, Would anyone know how to populate an asp dropdown with a dependant condition.
I need this dropdown to select only artists, ie from the authortwo field where in another field, ie extrathree, ...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |