SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot diskhub's Avatar
    Join Date
    Jun 2004
    Location
    singapore
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vb Dropdown menu

    Hi, I have a formview which is databind with my sql.
    I have everything display normally. However, in my sql, i have a column for inventorySize, and i wish to display a dropdown menu in the formview instead of just a text.

    How can I display the dropdown menu to dynamically achieved something like:
    1
    2
    3
    4
    5
    6

    if the inventorySize is 6?
    I LOVE PHP!!!

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Several ways. Put an <aspropDownList> control in there.

    Option 1: Populate the dropdownlist through code in a handler for the formview's databound event; or in Page_Load (suboptimal).

    Option 2: Create a method to return an enumeration of items and databind to this method.

    Option 3 (if using VS2008): use a declarative databinding expression like this:
    Code:
    DataSource='<%# System.Linq.Enumerable.Range(1, (int)Eval("inventorySize")) %>'


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •