FindControl() public méthode

public FindControl ( Type type, Control X ) : Control
type System.Type
X System.Web.UI.Control
Résultat System.Web.UI.Control
Exemple #1
0
        public void InstantiateIn(Control container)
        {
            PlaceHolder ph = new PlaceHolder();

            container.Controls.Add(ph);

            Control c = GetCtrl(ph);

            NavLinkForPagerTemplate lnkBtn = (NavLinkForPagerTemplate)cu.FindControl("lnkBtn", c);

            lnkBtn.DataBinding += new EventHandler(lnkBtn_DataBinding);

            ph.Controls.Add(c);

            //Literal litL = new Literal();
            //litL.Text = " [ ";
            //Literal litR = new Literal();
            //litR.Text = " ]   ";

            //NavLinkForPagerTemplate lnkBtn = new NavLinkForPagerTemplate();
            //lnkBtn.ID = "lnkBtn";
            //lnkBtn.CSSSelected = "selected";

            //lnkBtn.DataBinding += new EventHandler(lnkBtn_DataBinding);

            //container.Controls.Add(litL);
            //container.Controls.Add(lnkBtn);
            //container.Controls.Add(litR);
        }
        private Repeater GetCtrl(Control ctrl)
        {
            Repeater r = new Repeater();

            try {
                BasicControlUtils cu          = new BasicControlUtils(ctrl);
                Control           userControl = cu.CreateControlFromResource("Carrotware.Web.UI.Controls.ucFancyPager.ascx");
                r = (Repeater)cu.FindControl("rpPager", userControl);
            } catch { }

            return(r);
        }
        private Repeater GetCtrl(Control ctrl)
        {
            Repeater r = new Repeater();

            try {
                BasicControlUtils cu = new BasicControlUtils(ctrl);
                Control userControl = cu.CreateControlFromResource("Carrotware.Web.UI.Controls.ucFancyPager.ascx");
                r = (Repeater)cu.FindControl("rpPager", userControl);
            } catch { }

            return r;
        }