2.0 ASP.NET Wizard Control

  • Thread starter Thread starter Rain
  • Start date Start date
R

Rain

I have two buttons in the header template as I want to control the steps
from the top not the bottom. However, I cant seem to work out how to find
the controls within the wizard class.

Ive tried most things. Either it cant be got at or I havent tried it all (
most likely )

Thanks in advance.
 
Enable Trace in the page and identify the control in the control tree
hierarchy. You will also observe how the control you want to reference is
nested in other templates; there are two ways to pass each template to the
FindControl method.

// 1st approach
Button myButton = Page.FindControl("object1$object2$MyButton") as Button;

// 2nd approach
Button myButton =
Page.FindControl("object1").FindControl("object2").FindControl("MyButton")
as Button;

I've discovered sometimes one approach works and the other doesn't and I
have no idea why but the 2nd approach is most common and produces results
most often.

Using FindControl is called Late Binding. You can also use Early Binding is
you learn to reference your object in the page using a Public Property which
you can learn about by going to Google School as Early Binding is more
efficient and allows referencing the object directly as if it were a static
object (as I think it is correct to say).
 
Thanks

Seems odd that u cant get to the controls in the header through the header
property of the wizard, but thats probably because I dont fully understand
how the wizard works.
 
The Wizard is put together using the MultiView control. There is a DataList
control in the Sidebar. The Wizard control templates will take some time to
really learn well but will be worth the effort.
 
Thanks. In truth ive been coding .net for some time but never used the
wizard, ive been experimenting today with template and styling and you can
make it look pretty cool actually.

Thanks for all your help. Much appreciated.
 
Back
Top