Ejemplo n.º 1
0
        protected void AddCtl(string strNum)
        {
            GenericControl myControl = (GenericControl)LoadControl(_controlFileName);

            myControl.ID = "ctl_" + strNum;
            pnControl.Controls.Add(myControl);
        }
Ejemplo n.º 2
0
        protected void AddCtl(string controlFileName)
        {
            GenericControl myControl = (GenericControl)LoadControl("~/UserControls/" + controlFileName + ".ascx");

            myControl.ID = "ctl_" + controlFileName;
            Panel pn = new Panel();
            Label lb = new Label();

            lb.CssClass = "title";
            StringBuilder sb = new StringBuilder();

            foreach (char c in controlFileName)
            {
                if (sb.Length > 0 && char.IsUpper(c))
                {
                    sb.Append(" ");
                }
                sb.Append(c);
            }
            lb.Text = sb.ToString();
            pn.Controls.Add(lb);
            pn.CssClass = "box";
            pn.Controls.Add(myControl);
            pnControl.Controls.Add(pn);
        }