Hide next button from code behind in asp.net in wizard control
I have an asp.net page having a wizard control. I wanted to make visible false Next Button when other than Admin logged in (say dealer, subdealer log in). How to make it invisible or to change its text? I tried this li开发者_Go百科ne to make it in visible:
((Button)Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton")).Visible = false;
HTML is:
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="False" Width="90%" StepPreviousButtonText=""
StepPreviousButtonType="Image"
onfinishbuttonclick="Wizard1_FinishButtonClick"
onnextbuttonclick="Wizard1_NextButtonClick">
<NavigationStyle HorizontalAlign="Left" />
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
//Some design
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Step 1">
//Some design
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext"
Text="Next" />
</StartNavigationTemplate>
<FinishNavigationTemplate>
<asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
</FinishNavigationTemplate>
</asp:Wizard>
but sounds nothing there. What have I to do?
Try this...
((Button)Wizard1.FindControl("StartNavigationTemplateContainerID").FindControl("StepNextButton")).Visible = false;
I had replace StepNavigationTemplateContainerID
with StartNavigationTemplateContainerID
as you need to find from Start Naveigation
If you want to remove the StartNextButton just set StartNextButtonType
to "Link" and StartNextButtonText
to Empty. That should be the most easy way
精彩评论