ASCX User Controls and DDL.SelectedValue

Discussion in 'ASP .Net Web Controls' started by runtoofar@gmail.com, Oct 19, 2005.

  1. Guest

    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!
    , Oct 19, 2005
    #1
    1. Advertising

  2. 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.

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.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.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!
    >
    >
    Phillip Williams, Oct 19, 2005
    #2
    1. Advertising

  3. Guest

    Thanks, I knew it was something simple. Too bad I wasted many hours on
    a complex solution not needed!
    , Oct 19, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marina
    Replies:
    0
    Views:
    901
    Marina
    Aug 12, 2003
  2. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    why is ddl.selectedValue not retained in viewstate ?

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Oct 3, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    480
    JIMCO Software
    Oct 4, 2005
  3. Elmo Watson
    Replies:
    0
    Views:
    417
    Elmo Watson
    Jul 7, 2006
  4. J
    Replies:
    2
    Views:
    347
  5. Brett
    Replies:
    2
    Views:
    2,656
    Allen Chen [MSFT]
    Oct 15, 2008
Loading...

Share This Page