protected void FillDDL(DropDownList ddl, string sFilter)
 {
     ddl.AppendDataBoundItems = true;
     ddl.DataSource           = NorthwindAccess.GetSuppliersSDS(sFilter); // binds the SDS
     ddl.DataTextField        = "CompanyName";
     ddl.DataValueField       = "SupplierID";
     ddl.Items.Clear(); // clear any existing items
     ddl.DataBind();
     ddl.Items.Insert(0, new ListItem("Now Pick a Company form [" + ddl.Items.Count + "]", ""));
     ddl.AutoPostBack = true;
 }
예제 #2
0
    /// <summary>
    /// Fills the DDL on a filter input
    /// </summary>
    /// <param name="input"></param>
    protected void FillDropList(string input)
    {
        SqlDataSource result = NorthwindAccess.GetSuppliersSDS(input);

        SupplierDDL.AppendDataBoundItems = true;
        SupplierDDL.DataSource           = result;
        SupplierDDL.DataTextField        = "CompanyName";
        SupplierDDL.DataValueField       = "SupplierID";
        SupplierDDL.Items.Clear();
        SupplierDDL.DataBind();
        SupplierDDL.Items.Insert(0, new ListItem("Now pick a company from[" + SupplierDDL.Items.Count + "]"));
        SupplierDDL.AutoPostBack = true;
    }