Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

ASCX User Control Drop Down List Issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
runtoofar@gmail.com - 19 Oct 2005 17:26 GMT
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!
Sreejith Ram - 19 Oct 2005 17:40 GMT
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();
 }

> 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
[quoted text clipped - 12 lines]
>
> Any ideas?!  Thanks in advance!
runtoofar@gmail.com - 19 Oct 2005 19:01 GMT
Thanks, I knew it was something simple.  Too bad I wasted many hours on
a complex solution not needed!
Scott Allen - 20 Oct 2005 13:30 GMT
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/

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.