Hi All,
I have usercontrol and aspx page which uses a master page. A placeholder is used to add the usercontrol dynamically. The placeholder is inside a wizard control.
The usercontrol gets loaded for first time on button click and in the same click event I am trying to find a button control and hide it while first loading itself.
.aspx page
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><asp:Wizard ID="wzItems" runat="server" DisplaySideBar="False" ActiveStepIndex="0"><WizardSteps><asp:WizardStep ID="wsStep1" runat="server" Title="Step1"><div class="content">This is Step 1</div></asp:WizardStep><asp:WizardStep ID="wsStep2" runat="server" Title="Step2"><div class="content">This is Step 2</div></asp:WizardStep><asp:WizardStep ID="wsStep3" runat="server" Title="Step3"><asp:PlaceHolder ID="phItems" runat="server"></asp:PlaceHolder></asp:WizardStep><asp:WizardStep ID="wsStep4" runat="server" Title="Step4"><div class="content">This is Step 4</div></asp:WizardStep></WizardSteps
Below is the codebeind code to load user control and find the button control inside it
protected void btnControl_OnClick(object sender, EventArgs e) { UserControl ucItems = LoadControl("~/User/Items.ascx") as UserControl; ucItems.ID = "ucCarItems"; phItems.Controls.Add(ucItems); Button btnControl = (Button)ucItems.FindControl("btnControl "); btnControl.Style.Add("display", "none"); }
The problem is I am not able to find it. Please guide on this.