I put a Literal control in the tag in the Wizard control.
In the codebehind, I can't access that control.
Why is that?
I put a Literal control in the tag in the Wizard control.
In the codebehind, I can't access that control.
Why is that?
Did you try this:
Literal literal = MyWizard.FindControl("MyLiteral") as Literal;
if (literal != null)
// do something with literal
(Maybe you tried but how can I know that from your question?)
Any sort of template control (Wizard, Repeater, etc.) doesn't expose the controls inside the template as member variables. You will need to use FindControl on the correct Step.
i.e.,
var myStep = wizard.Steps[1]; // or however you want to find it
var myLiteral = myStep.FindControl("MyLiteral") as Literal;
if you have other templated controls within your wizard Step, you'd need to do a "FindControl" on those as well to continue drilling down to your literal. I created a "FindControlRecursive" extension method to make this easier.