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";

  • 相关阅读:
    题解 P2812 【校园网络【[USACO]Network of Schools加强版】】
    拓展卢卡斯定理(伪)
    [洛谷P3807] 【模板】卢卡斯定理
    一道使用Fibonnaci数列通项公式的趣味题目
    [洛谷P3292] [SCOI2016]幸运数字
    [洛谷P3812] 【模板】线性基
    [洛谷P3857] [TJOI2008]彩灯
    2019.06.17课件:[洛谷P1310]表达式的值 题解
    常数PK系列汇总
    关于BFS和dijkstra(2019.04.20)
  • 原文地址:https://www.cnblogs.com/alexzp/p/2355794.html
Copyright © 2011-2022 走看看