Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Wizard Next Button Error

Thread Tools

Wizard Next Button Error

Posts: n/a
I have a web page with a master page and a contents page. On the contents
page I have a wizard as defined below:
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="1"
DisplayCancelButton="True" Height="85px" Width="647px"
OnActiveStepChanged="OnActiveStepChanged_SaveCurrP revIndex"

<StepStyle HorizontalAlign="Left" VerticalAlign="Top" />
<asp:Button ID="StartNextButton" runat="server"
CommandName="MoveNext" Visible="false"
Text="Next" />
<asp:Button ID="CancelButton" runat="server"
CommandName="Cancel" Text="Cancel" />
<asp:WizardStep runat="server" StepType="Start" title="Step 1">
<code style="font-family: Verdana; font-size: 10pt; color:
navy; ">Step1...</code>
<asp:WizardStep runat="server" StepType="Start" title="Step 2">
<code style="font-family: Verdana; font-size: 10pt; color: navy;
<SideBarStyle VerticalAlign="Top" />
<asp:Button ID="StepPreviousButton" runat="server"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server"
Text="Next" Visible="false"/>
<asp:Button ID="CancelButton" runat="server"
CommandName="Cancel" Text="Cancel" />

I also have a script defined to set display of the StepNextButton in the
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
TextBox3.Text = "0";
TextBox4.Text = "0";

protected void OnActiveStepChanged_SaveCurrPrevIndex(object sender,
EventArgs e)
if (IsPostBack)
//NOT first time
TextBox3.Text = TextBox4.Text;
TextBox4.Text = Wizard1.ActiveStepIndex.ToString();

if (Wizard1.ActiveStepIndex == 1)
Button btn =
(Button)Wizard1.FindControl("StepNavigationTemplat eContainerID$StepNextButton");
btn.Visible = true;

if (Wizard1.ActiveStepIndex >1)
Button btn =
(Button)Wizard1.FindControl("StepNavigationTemplat eContainerID$StepNextButton");
btn.Visible = false;

When this page is activated, I get the following error:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 53: {
Line 54: Button btn =
(Button)Wizard1.FindControl("StepNavigationTemplat eContainerID$StepNextButton");
Line 55: btn.Visible = true;
Line 56: }
Line 57:

Can you tell me why and what I need to change?

Thanks for your help.

J Mehta
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Next button text for wizard step. M. Ali Qureshi ASP .Net 3 01-04-2008 10:46 PM
asp:Wizard control - hiding "next" button on certain steps. Nick Gilbert ASP .Net 5 01-24-2007 06:47 AM
add a link button to prev/next in a wizard David Thielen ASP .Net Web Controls 2 10-01-2006 10:55 PM
Hide Next Button on Wizard Control 2.0 ? =?Utf-8?B?TU9VU1RBRkEgQVJBRkE=?= ASP .Net 1 09-12-2006 02:02 PM
CurrentElement->next = CurrentElement->next->next (UNDEFINED?) Deniz Bahar C Programming 2 03-09-2005 12:45 AM