asp.net wizard?

M

Mike

I'm helping out on a web app and the developer that created the aspx pages is using <asp:wizard> on the form. There are dropdowns, labels, buttons, etc within each wizard.

How can I find a button in one of these wizards? I'm using something like

Button btn = (Button)Wizard.WizardStep[4].FindControl("button1");
btn.visible = false;

but I keep getting the error:
'Error: Object reference not set to an instance of an object'

how can find the button in the wizard so I can hide it?
 
R

Rob Meade

...
how can find the button in the wizard so I can hide it?

If you run your app in debug mode can you stick a break point on the
page_load or event handler for that button, and then travese the properties
of the page/sender etc to see exactly what its called? The info contained
here might help you with the FindControl method.

HTH

Regards

Rob
 
M

Mike

i did that, I ran the page and did view source and got the actual control
name, and plugged that in the FindControl() and I still got the same error
message.
 
C

clintonG

Enable trace in the page. You will be able to identify your button1 control
by reading through the control hierarchy. We must reuse the object name
hierarchy with the FindControl method. The use of the FindControl method
becomes somewhat convoluted when using MasterPages as you will often need to
use repetitive instances of the FindControl method in the same statement
which you will use to instantiate a btn object.

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/



I'm helping out on a web app and the developer that created the aspx pages
is using <asp:wizard> on the form. There are dropdowns, labels, buttons, etc
within each wizard.

How can I find a button in one of these wizards? I'm using something like

Button btn = (Button)Wizard.WizardStep[4].FindControl("button1");
btn.visible = false;

but I keep getting the error:
'Error: Object reference not set to an instance of an object'

how can find the button in the wizard so I can hide it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top