ASPX Dropdownlist

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean

    #1

    ASPX Dropdownlist

    Hi,

    I have an ASPX Dropdown list.

    I am unsure how to set my datasource.

    I have a table that has 2 columns, an identity column and
    a description column.

    Has anyone got some sample code on how to do this.

    I find it hard to get any sample code on the web.

    Thanks,
    Sean
  • Karsten Grombach

    #2
    Re: ASPX Dropdownlist

    hi Sean,

    look at http://samples.gotdotnet.com/quickstart/aspplus/ for a lot of
    samples..

    for your ddl problem:

    DropDownList ddl = new DropDownList();
    ddl.DataSource = yourDataTable; /// can also be a DataSet
    ddl.DataTextFie ld = "NameOfFieldWhi chContainsText" ;
    ddl.DataValueFi eld ="NameOfFieldWh ichContainsValu e";
    ddl.DataBind(); /// get the values from the DataSource

    that should do the trick
    regards
    karten

    "Sean" <sean@asp.com > schrieb im Newsbeitrag
    news:050201c35d 5f$282649a0$a60 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > I have an ASPX Dropdown list.
    >
    > I am unsure how to set my datasource.
    >
    > I have a table that has 2 columns, an identity column and
    > a description column.
    >
    > Has anyone got some sample code on how to do this.
    >
    > I find it hard to get any sample code on the web.
    >
    > Thanks,
    > Sean[/color]


    Comment

    Working...