control inside Wizard <StepNavigationTemplate> tag isn't available in code-behind?
I put a Literal control 开发者_运维问答in the tag in the Wizard control.
In the codebehind, I can't access that control.
Why is that?
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.
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?)
精彩评论