Get object from DropDownList bound to object

Discussion in 'ASP .Net' started by Grant Merwitz, Jun 30, 2006.

  1. Hi

    I have an array of object.
    I am binding this array to a dropdownlist

    On the dropdown's selected index changed, can i retrieve the object from the
    selected value.
    I know i can get the text and value, but is it possible to get the object
    from the datasource

    something along the lines of:
    SomeObject so = (SomeObject)dropdown.DataSource;

    When i try this i see the DataSource is null;

    TIA


    TIA
     
    Grant Merwitz, Jun 30, 2006
    #1
    1. Advertising

  2. Wouldn't it be

    SomeObject so = (SomeObject)dropdown.SelectedItem;


    --
    Robbe Morris - 2004-2006 Microsoft MVP C#
    Earn money answering .NET questions
    http://www.eggheadcafe.com/forums/merit.asp





    "Grant Merwitz" <> wrote in message
    news:%...
    > Hi
    >
    > I have an array of object.
    > I am binding this array to a dropdownlist
    >
    > On the dropdown's selected index changed, can i retrieve the object from
    > the selected value.
    > I know i can get the text and value, but is it possible to get the object
    > from the datasource
    >
    > something along the lines of:
    > SomeObject so = (SomeObject)dropdown.DataSource;
    >
    > When i try this i see the DataSource is null;
    >
    > TIA
    >
    >
    > TIA
    >
     
    Robbe Morris [C# MVP], Jul 6, 2006
    #2
    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. Bill
    Replies:
    3
    Views:
    547
  2. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,356
    thushara wijeratna
    Oct 7, 2008
  3. Rhiner Dan
    Replies:
    1
    Views:
    773
    Mike Wahler
    Mar 27, 2005
  4. Mario Krsnic
    Replies:
    0
    Views:
    400
    Mario Krsnic
    Jun 23, 2006
  5. Phillip Vong
    Replies:
    0
    Views:
    434
    Phillip Vong
    Jul 27, 2006
Loading...

Share This Page