Ext.NET -- 后台动态添加控件

    

    protected void btnAddItem_Click(object sender, EventArgs e)
        {
            int index = this.GetIndexVal();
            //Ext.Net.FieldSet fieldSet = new Ext.Net.FieldSet
            //{
            //    ID = "fieldSet" + index,
            //    Border = false
            //};

            HiddenField hf = new HiddenField
            {
                ID = "hidden" + index,

            };

            Ext.Net.Checkbox checkbox = new Ext.Net.Checkbox
            {
                ID = "checkbox" + index,
            };


            Ext.Net.FieldContainer fieldContainer = new Ext.Net.FieldContainer
            {
                ID = "fieldContainer" + index,
                Layout = "HBoxLayout",
                Border = false
            };

            Ext.Net.TextField itemField = new Ext.Net.TextField
            {
                ID = "itemField" + index,
                FieldLabel = "项目",
                LabelWidth = 50,
                Text = "项目"
            };
            Ext.Net.TextField accountField = new Ext.Net.TextField
            {
                ID = "accountField" + index,
                FieldLabel = "金额",
                LabelWidth = 50,
                Text = "金额"
            };
            fieldContainer.Items.Add(checkbox);
            fieldContainer.Items.Add(itemField);
            fieldContainer.Items.Add(accountField);

            splitItemForm.AddTo(this.splitFieldSet);
            //this.splitFieldSet.Items.Add(fieldContainer);


            //fieldSet.Items.Add(fieldContainer);

            //fieldSet.AddTo(this.splitFieldSet);

            Panel1.Expand();
            splitItemForm.Render();
        }

        private int GetIndexVal()
        {
            int idx = Convert.ToInt32(index) + 1;
            index = idx.ToString();
            this.Hidden1.Text = idx.ToString();
            return idx;
        }
       /* protected void btnDelItem_Click(object sender, EventArgs e)
        {
            Ext.Net.Checkbox checkbox = new Ext.Net.Checkbox();
            for (int i = 0; i < this.splitFieldSet.Items.Count; i++)
            {
                checkbox = (Ext.Net.Checkbox)this.splitFieldSet.Items[i].FindControl("checkbox" + i + "-inputEl");


                Control control = this.Panel1.FindControl(this.btnSave.ID);
                String btnSaveId = control.ID;
            }
        }
          */


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值