Binding an array to a DropDownList

Discussion in 'ASP .Net Web Controls' started by paul.hester@gmail.com, Sep 13, 2006.

  1. Guest

    Hi all,

    I'd like to bind an array to a DropDownList and use the array index as
    the DataValueField. Is this possible?

    Thanks,

    Paul
     
    , Sep 13, 2006
    #1
    1. Advertising

  2. Than array you can bind a collection based class which has values as
    objects in that collection class

    Define a class like
    Public Class Student
    {
    public string Name;
    public int ID
    }

    public Class StudentCollection:System.Collection.CollectionBase
    {
    public Student this[int i]
    {
    get
    {
    return (Student)this.base.List
    }
    set
    {
    this.base.List=value;
    }
    }
    }

    And this class could be bound to any controls
     
    Savil Francis, Sep 13, 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. Jordan
    Replies:
    2
    Views:
    2,573
    Jordan
    Feb 10, 2004
  2. Amit
    Replies:
    6
    Views:
    13,917
    Assimalyst
    Oct 24, 2006
  3. Paul
    Replies:
    1
    Views:
    2,625
    Eliyahu Goldin
    Sep 13, 2006
  4. Binding an array to a DropDownList

    , Sep 13, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    130
  5. pc

    Binding dropdownlist to multi-dimension array

    pc, Mar 9, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    144
Loading...

Share This Page