Ejemplo n.º 1
0
    /// <summary>
    /// Populates the values for a dropdown.
    /// Find a control is a bit tricky for DataLists since you have
    /// to loop through each item (row in the table) and find the
    /// control there.
    /// </summary>
    private void PopulateFrameDropdown()
    {
        FrameCollection fc = new FrameCollection();

        fc.FetchAll();
        DropDownList dd = null;
        int          i  = 0;

        foreach (ArtWork aw in ArtInTheCart)
        {
            dd = (DropDownList)listCart.Items[i].FindControl("drpFrame");
            foreach (Frame f in fc)
            {
                string   drpText = f.Title + String.Format(" - {0:c}", f.Price);
                ListItem li      = new ListItem(drpText, f.Price.ToString());
                dd.Items.Add(li);
            }
            dd.SelectedIndex = 0;
            i++;
        }
    }