예제 #1
0
 void initDropSize(ref DevExpress.Web.ASPxComboBox cmb, object ds)
 {
     cmb.DataSource = ds;
     cmb.TextField  = "Size";
     cmb.ValueField = "Id";
     cmb.DataBind();
 }
 void dropDown_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ListEditItemsRequestedByFilterConditionEventArgs e)
 {
     if (String.IsNullOrEmpty(e.Filter) || e.Filter.Length < NUMBER_CHAR_SEARCH)
     {
         return;
     }
     DevExpress.Web.ASPxComboBox editor = source as DevExpress.Web.ASPxComboBox;
     //editor.Items.Clear();
     //IList ds = GetLookupSource(e.Filter);
     //for(int i = e.BeginIndex; i < Math.Min(e.EndIndex + 1, ds.Count); i++) {
     //    editor.Items.Add(Helper.GetEscapedDisplayText(ds[i], EmptyValue, DisplayFormat), Helper.GetObjectKey(ds[i]));
     //}
     editor.DataSource = GetLookupSource(e.Filter);
     editor.DataBind();
 }
예제 #3
0
 public static void LoadToCombo(DevExpress.Web.ASPxComboBox objCombo, bool isAll, DataTable dt, string TextField, string ValueField)
 {
     if (isAll)
     {
         DataRow dr = dt.NewRow();
         dr[ValueField] = "0";
         dr[TextField]  = "";
         dt.Rows.InsertAt(dr, 0);
     }
     objCombo.DataSource = dt;
     objCombo.TextField  = TextField;
     objCombo.ValueField = ValueField;
     objCombo.DataBind();
     objCombo.SelectedIndex = 0;
 }
예제 #4
0
        public void LoadToCombo(DevExpress.Web.ASPxComboBox objCombo, bool isAll, string code)
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections(TABLE_NAME);

            col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.NVarchar, "code", FieldTypes.Criterion, code, "=");
            DataTable dt = dao.DoQuery(col, ref iResult);

            if (isAll)
            {
                DataRow dr = dt.NewRow();
                dr["value"] = "0";
                dr["text"]  = "";
                dt.Rows.InsertAt(dr, 0);
            }
            objCombo.DataSource = dt;
            objCombo.TextField  = "text";
            objCombo.ValueField = "value";
            objCombo.DataBind();
            objCombo.SelectedIndex = 0;
        }
예제 #5
0
    public static bool SetComboStyle(ref DevExpress.Web.ASPxComboBox Combo, EnumDefineStyle DefineStyle,
                                     string DefaultValue = "", string Criteria = "", bool AddEmptyRow = false)
    {
        //return false;
        int[] aryColWidth = null;
        //Combo. = false;
        //Combo.LimitToList = true;
        //Combo.DropMode = C1List.DropModeEnum.Automatic;
        //Combo.AutoCompletion = true;
        //Combo.AutoDropDown = true;
        //Combo.ExtendRightColumn = true;
        //Combo.DropdownPosition = C1List.DropdownPositionEnum.RightDown;
        GeneralControl CountryBase = new GeneralControl();
        AgentControl   objAgent    = new AgentControl();

        Combo.DropDownWidth = 230;
        List <Country_Info> lstCountry  = new List <Country_Info>();
        List <CODEMASTER>   lstOpt      = new List <CODEMASTER>();
        DataTable           dataCountry = new DataTable();

        switch (DefineStyle)
        {
        case EnumDefineStyle.Style1:
            Combo.DropDownWidth = 0;
            //Combo.ColumnHeaders = false;
            //Combo.LimitToList = true;
            //Combo.DropMode = C1List.DropModeEnum.Automatic;
            //Combo.AutoCompletion = true;
            //Combo.AutoDropDown = true;
            //Combo.ExtendRightColumn = true;
            //Combo.DropdownPosition = C1List.DropdownPositionEnum.RightDown;
            return(true);

        case EnumDefineStyle.Country:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            lstCountry = CountryBase.GetAllCountry();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "countryName";
            Combo.ValueField = "countrycode";
            Combo.DataSource = lstCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.State:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            lstCountry = CountryBase.GetAllState(Criteria);
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "provinceStateName";
            Combo.ValueField = "provincestatecode";
            Combo.DataSource = lstCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.Opt:
            //p(Combo, objSelect.CustomSelect(EnumCustomSelect.State, Criteria, EnumTypeOrder.ByDesc),,, EnumComboStyle.DescOnly);
            //lstOpt = CountryBase.GetAllCODEMASTERFilter();
            Combo.Items.Clear();
            Combo.TextField  = "CodeDesc";
            Combo.ValueField = "Code";
            Combo.DataSource = lstOpt;
            Combo.DataBind();
            Combo.DropDownWidth = 150;
            Combo.SelectedIndex = 0;
            return(true);

        case EnumDefineStyle.CountryCard:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            dataCountry = CountryBase.GetAllCountryCard();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "Name";
            Combo.ValueField = "CountryCode";
            Combo.DataSource = dataCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.Years:
            Combo.Items.Clear();
            for (int i = 0; i < 20; i++)
            {
                Combo.Items.Add((DateTime.Now.Year - i).ToString());
            }
            Combo.DropDownWidth = 50;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.YearsPlus:
            Combo.Items.Clear();
            for (int i = 0; i < 20; i++)
            {
                Combo.Items.Add((DateTime.Now.Year + i).ToString());
            }
            Combo.DropDownWidth = 50;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.AgentCategory:
            DataTable dt = objAgent.GetAllAgentCategory();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.TextField  = "AgentCatgDesc";
            Combo.ValueField = "AgentCatgID";
            Combo.DataSource = dt;
            Combo.DataBind();
            Combo.DropDownWidth = 280;

            //aryColWidth = null;
            return(true);

        default:
            return(false);
        }
    }