Thursday, 22 May 2014

Find Control UserControl to UserControl , Find Control of Master page, Find html Control of Master page,Find Control in parent page


UserControl objOfUserControl = (UserControl)Page.FindControl("UserControlID");
        TextBox txtLocation = objOfUserControl.FindControl("txtLocation") as TextBox;
        txtLocation.Enabled = false;

 ContentPlaceHolder MainContent = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
        HtmlGenericControl divviewgride = (HtmlGenericControl)MainContent.FindControl("divviewgride") as HtmlGenericControl;
        divviewgride.Visible = true;

 ContentPlaceHolder MainContent = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
        LinkButton ResultsLabel = MainContent.FindControl("lnkTags") as LinkButton;
        ResultsLabel.Visible = false;

No comments:

Post a Comment