コード例 #1
0
        public ChildrenControl Add()
        {
            string fieldCount = tx_Qty.Text;
            int    count      = string.IsNullOrEmpty(fieldCount) ? 0 : Convert.ToInt32(fieldCount);


            ChildrenControl MyControl = (ChildrenControl)Page.LoadControl(ChildControlURL);


            MyControl.ID = "ChildControl_" + count;

            count++;


            ChildControlList.Add(MyControl);
            DynamicPlaceHolder.Controls.Add(MyControl);

            tx_Qty.Text = count.ToString();

            return(MyControl);
        }
コード例 #2
0
        void CreateTextBoxSet(int count, PlaceHolder holder)
        {
            //PlaceHolder MyControl = new PlaceHolder();
            //MyControl.ID = "SubHolder_" + count;

            //for (int i = 0; i < 3; i++)
            //{
            //    TextBox txt1 = new TextBox();
            //    Literal lit1 = new Literal();
            //    txt1.ID = "Literal_" + i + "_" + count;
            //    lit1.ID = "TextBox_" + i + "_" + count;
            //    lit1.Text = "&nbsp;<br/>";
            //    MyControl.Controls.Add(txt1);
            //    MyControl.Controls.Add(lit1);
            //}
            ChildrenControl MyControl = (ChildrenControl)Page.LoadControl(ChildControlURL);


            MyControl.ID = "ChildControl_" + count;

            ChildControlList.Add(MyControl);
            holder.Controls.Add(MyControl);
        }