Sometimes we need to find a control from Wizard navigation steps. For that we need to use FindControl() method but we fail in this case, as we always get null when using WizardId.FindControl(“ControlId”).
Why?
Because when ASP.NET adds the navigation area controls to the wizard control, it adds a prefix onto the control name.
So to find the control,we need to add the appropriate prefix to the control name, like the following:
Navigation Templates Prefix ————————- ——————————————- StartNavigationTemplate StartNavigationTemplateContainerID$ StepNavigationTemplate StepNavigationTemplateContainerID$
FinishNavigationTemplate FinishNavigationTemplateContainerID$
Example:
Finish
For example, if you want to find a button named “btnTest” in the finish navigation step, you would have to use a line of code.
var testButton= wizTest.FindControl("FinishNavigationTemplateContainerID$btnTest") as Button; if(testButton != null) { testButton.Visible = true; //Show the test button }