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

ASCX User Control Drop Down List Issues

I have an ASCX user control with a drop down list inside an ASPX (C#)
page. The user selects an item from the DDL, clicks a button, and the
DDL.SelectedValue is supposed to be sent to another function. However,
the SelectedValue is always the first value in the DDL. I have tried
several methods to work around this including the examples at:

http://www.mastercsharp.com/article....=67&&TopicID=2
http://odetocode.com/Articles/116.aspx

Everytime however no matter what method is used, I cannot get the true
SelectedValue of the drop down list.

All the functions required are inside the ASCX page, there is nothing
needing to be called in the parent ASPX or C# code-behind.

Any ideas?! Thanks in advance!

Nov 19 '05 #1
3 2188
Have you checked If the databinding happening in all postbacks?
The code in Page_load of control should be like below

if(!Page.IsPostBack())
{
yourDDl.datasource =something;
yourDDl.DataBind();
}

"ru*******@gmail.com" wrote:
I have an ASCX user control with a drop down list inside an ASPX (C#)
page. The user selects an item from the DDL, clicks a button, and the
DDL.SelectedValue is supposed to be sent to another function. However,
the SelectedValue is always the first value in the DDL. I have tried
several methods to work around this including the examples at:

http://www.mastercsharp.com/article....=67&&TopicID=2
http://odetocode.com/Articles/116.aspx

Everytime however no matter what method is used, I cannot get the true
SelectedValue of the drop down list.

All the functions required are inside the ASCX page, there is nothing
needing to be called in the parent ASPX or C# code-behind.

Any ideas?! Thanks in advance!

Nov 19 '05 #2
Thanks, I knew it was something simple. Too bad I wasted many hours on
a complex solution not needed!

Nov 19 '05 #3
Do you have an event handler for the drop down list's SelectionChanged
event? That would be an ideal spot to pick up the new value - I'm not
sure how data binding will help.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 19 Oct 2005 11:01:18 -0700, "ru*******@gmail.com"
<ru*******@gmail.com> wrote:
Thanks, I knew it was something simple. Too bad I wasted many hours on
a complex solution not needed!


Nov 19 '05 #4

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

Similar topics

1
by: George Durzi | last post by:
I have a JavaScript called common.js that is referenced by every ASPX in my web application. In common.js, I have a funtion called findText (which I use to help me navigate through drop down lists...
3
by: John Crowley | last post by:
I've run into a problem where drop down lists are refusing to data bind with the following error on the DataBind() call Specified argument was out of the range of valid values. Parameter name:...
7
by: microsoftboy | last post by:
Hi, Using the following selection criteria, I am able to list the data from mysql db, but I would like to provide the following options for users: Select All Data, Select None. I am not sure if...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.