开发者

Hide button on asp.net wizard

开发者 https://www.devze.com 2023-01-02 18:52 出处:网络
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 nullto make alejandrobo

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"

0

精彩评论

暂无评论...
验证码 换一张
取 消