ASCX User Controls and DDL.SelectedValue

R

runtoofar

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.aspx?ArticleID=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!
 
P

Phillip Williams

Does your ascx user control databind the dropdownlist upon every postback? if
yes then that is the reason you are getting always the first item as the
selected value.
 
R

runtoofar

Thanks, I knew it was something simple. Too bad I wasted many hours on
a complex solution not needed!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top