Hide button on asp.net wizard
net wizard, and im tryng to hide the next button on some cases. My problem is that I can't seem to fin the b开发者_运维技巧utton using WizardFindControl("") it always return null
to make alejandrobog's work, u must Convert to StepNavigation Template
<StepNavigationTemplate>
<asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious">Previous</asp:Button>
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext">Next</asp:Button>
</StepNavigationTemplate>
then FindControl works
Button btnPre = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepPreviousButton");
btnPre.Visible = false;
Button btnNext = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButton");
btnNext.Visible = false;
I recently have this issue found out that you need to add StepNavigationTemplateContainerID$ before your control id
Check out this blog
Button finishButton = Wizard1.FindControl("StepNavigationTemplateContainerID$FinishButton") as Button;
((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("btnBack")).Visible = false;
FinishNavigationTemplateContainerID
could also be StepNavigationTemplateContainerID
- thats a fix name, don't use the ID you gave <asp:WizardStep ID="Step2"
Wizard1
is the ID of your asp:Wizzard
btnBack
is the ID of your asp:Button
like
<FinishNavigationTemplate> <asp:Button ID="btnBack"
精彩评论