zoukankan      html  css  js  c++  java
  • Ext.Net中动态创建Combox及动态添加其Items【总结】

                    Ext.Net.ComboBox combox = new Ext.Net.ComboBox();
                    combox.ID = TCMUtility.GuidToControlID(formField.SYSID, "field");
                    combox.Height = Unit.Parse("25px");
                    combox.Width = Unit.Parse("280px");
                    combox.LabelAlign = LabelAlign.Right;
                    combox.FieldLabel = formField.FIELDNAME;
                    combox.X = 0;
                    combox.Y = numY;
                    combox.Editable = false;
                    combox.Resizable = true;
                    combox.AllowBlank = formField.ALLOWNULL;

                    JsonReader ar = new JsonReader();
                    RecordField rf = new RecordField("DATA", RecordFieldType.String);
                    RecordField rf2 = new RecordField("VALUE", RecordFieldType.String);
                    ar.Fields.Add(rf);
                    ar.Fields.Add(rf2);
                    Store myStore = new Store();
                    myStore.Reader.Add(ar);
                   

                    //如果是下拉框,需要把所有下拉值填充进去,以便用户选择
                    List<StringEntity> list = new List<StringEntity>();
                    string valueList = formField.VALUELIST ?? "";
                    if (valueList.Length != 0)
                    {
                        string[] numValue = valueList.Split(';');
                        for (int j = 0; j < numValue.Count(); j++)
                        {
                            StringEntity value = new StringEntity();
                            value.DATA = numValue[j].ToString();
                            value.VALUE = numValue[j].ToString();
                            list.Add(value);
                        }

                        myStore.DataSource = list;
                        myStore.DataBind();                                
                    }
                    combox.Store.Add(myStore);
                    combox.DisplayField = "DATA";
                    combox.ValueField = "VALUE";

  • 相关阅读:
    3.25训练题
    hdu1495
    poj1426 宽搜
    高斯消元
    codeforces 999E 强联通分量
    hdu4289城市与歹徒 网络流
    蒟蒻的离散化模板
    樱花,素数筛
    【转】分圆问题:一个诡异的数列规律
    hdu1257最少拦截系统 贪心
  • 原文地址:https://www.cnblogs.com/alexzp/p/2355794.html
Copyright © 2011-2022 走看看